Hi all!
That's a very difficult question!
How can I unlock the "my account" item into the menu administration.
I'd like to remove this item from my menu.

Thanks.

Comments

coreb’s picture

Why would you need that? To deny the user the ability to edit their account?

That is the only way for them to change their password, email, username, etc. Denying them that could possibly lock them out should they change email address or forget their password.

Sascha Mantscheff’s picture

Me, too: I'd like to customize a menu and show the "My account" link in a "Members only" branch of the menu, not at the top. So I double the question.

anner’s picture

People who aren't logged in are not going to see the My Account in the menu. So why would it need to me moved to a member's only section? If they are seeing it, they are a member.

Sascha Mantscheff’s picture

As of now, the "My account" menu item sits at menu top. I'd like to move it down the hierarchy so that it only appears in a submenu - and with a different title, too.

decola’s picture

I want my users can change their personal infos via another page that limits their freedom of changes.

So I'd like the 'My account' menu item (and the related page) disappears.

Please, have somebody done that yet?

Sascha Mantscheff’s picture

Look for "Your personal page" (line 768 in my installation)
Bracket the following menu item code in comment brackets:

/*
    if ($user->uid) {
      $items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'),
        'callback' => 'user_view', 'callback arguments' => array(arg(1)), 'access' => TRUE,
        'type' => MENU_DYNAMIC_ITEM);
    }
*/

Be sure to include a menu item with the path /user in your menu so that users can access their pages.
I had to edit my menu first before the change became visible. Some caching problems, I assume.

decola’s picture

Thanks a lot, Sasha :-)

doc2@drupalfr.org’s picture

Line 780 on Drupal 5

Sascha, this is not unlocking the menu item, but just hiding it from the menus...

Or did I miss something?

darumaki’s picture

My Account really needs to be taken out of Navigation, this makes it next to impossible to create a custom template, I guess I could always do it the hard way and rip the code out with me bare hands arghh

zahor’s picture

You can always use the Me Aliases module to (drupal.org/project/me I think) to create a link to user/me.

mpaler’s picture

There's no reason (that I can see) that the My Account link needs to be locked. I would submit this as an issue if I knew where to submit one!? Anybody know where to submit an issue with the user.module?

vm’s picture

yes:

submit it against drupal in the first drop ddonw, then choose the user.module in the component drop down of the next screen.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

mpaler’s picture

Deterius’s picture

Which file would "your personal page" refer to?

Where would it be in your installation?

sorry- im sure this is a dumb question.

vm’s picture

personal page, would be your own profile when logged in which can be seen at yoursite.com/user (with clean urls on)

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

OutCast’s picture

this may help some one, if you would like to change the name of My account

Look in this code if ($user->uid) {
$items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'),
'callback' => 'user_view', 'callback arguments' => array(arg(1)), 'access' => TRUE,
'type' => MENU_DYNAMIC_ITEM);

'title' => t('my account'), right there where is says my account just change that to the name you want
I changed mine to My Home and it worked flawlessly :)

doc2@drupalfr.org’s picture

Might not this hack cause problems to the locale.module? Would there be a more stable workaround?

Anonymous’s picture

In user.module, i put:

// Your personal page
if ($user->uid) {
$items[] = array('path' => 'user/'. $user->uid, 'title' => t($user->name),
'callback' => 'user_view', 'callback arguments' => array(arg(1)), 'access' => TRUE,
'type' => MENU_NORMAL_ITEM);
}

which works great !

reg’s picture

A client of mine wants to have a single login that all their VIP clients use. There is no need in this case to have one account per person. You don't want all these people logging in under one account to be able to go to My account and edit, let's say the password, which in this case is something that many people share. I'm sure others have other scenarios that are just as valid for hiding or unlocking the My account menu item. In my case I only want to hide it from one specific user.

grobemo’s picture

Here's a quick way to alter or remove the 'My account' menu item without hacking into the core. It works in 5.6, at least.

The basic idea is to alter the $primary_links array before it's rendered by the theme_links function.

Add the following function to your template.php file. The function illustrates some of the things you can do to 'My account'. You'll want to remove or comment out some of the things it's doing to suit your needs.


/**
 * Override the primary links theming and alter the 'My account' menu item.
 */
function phptemplate_links($links_array,$links_class) {

	foreach($links_array as $key => &$link) {
		if ($link['title']=='My account') {

			/**
			 * Use this code if you want to change the 'My account' menu item to a logout menu item.
			 * Be sure to leave your users some way to get their user page!
			 */
			$link['title'] = 'log out';
			$link['href'] = 'logout';

			/**
			 * Use this code if you want to change the text of the 'My account' menu item to the user's username
			 */
			global $user;
			$link['title'] = $user->name;
	
			/**
			 * Use this code if you want to remove the 'My account' menu item altogether.
			 */
			unset($links_array[$key]);
		}
	}
	
	return theme_links($links_array,$links_class);
}

You could also do all of the link theming yourself, if you want, instead of calling theme_links at the end. Look at http://api.drupal.org/api/function/theme_links to see how theme_links works.

reg’s picture

This works for the Primary Links but My account is locked into the Navigation menu.

zorroposada’s picture

This code works really good but I believe there is an extra & character in it where it says:

foreach($links_array as $key => &$link) {

should be:
foreach($links_array as $key => $link) {

I copied and pasted this code into my template.php and got blank page but then I removed the & and worked perfect.

eevul’s picture

Here is another example of why someone would want to remove the ability for users to edit their accounts:

We have our Drupal 5.7 site authenticating to our AD through the LDAP module. We do not want users to be able to change their passwords so we use this module to accomplish that: http://drupal.org/project/noreqnewpass

The problem with that module is that it still gives the user the ability to change their email address which is retrieved from the AD. There is no reason that the user should be able to change their email address since this is done at our Corporate IT. I am still looking for a module to remove the ability for users to change their email address.

jyork’s picture

The easiest way I have found of moving this link is at http://drupal.org/node/163089. If you create a menu item in any menu you want with the path of "user", the My account link moves there. If you don't want users to be able to change their account, you can create a new menu, add a menu item with the path of "user", then configure the menu block at admin/build/block to be accessible only to certain roles (such as admin). You can also disable the block if you don't want anyone to see it.

aangel’s picture

The method at that link worked nicely for me on a 5.10 installation.
Andre'