By cbooth7575 on
Hi everybody,
I'm trying to figure out how to put a link to "My Account" (which is users/$username) on my top navigation block. I can only enter hard-coded links in there, not PHP code, from what I can tell.
Is there are way to inject a menu item into there via hook_menu or something? I see the default "My Account" on my navigation, which I have displayed on the left column..but I can't move it, it's marked "locked", and it's the only menu item like that.
Any suggestioins would be great..thanks!
Cameron
Comments
i know, i am searching for a
i know, i am searching for a solution to move around this link, too. Its kinda ugly being on its own. My account should have its own menu, like Account link, where all the links that required logging in will show up here once logged.
Tecito.com
Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.
Got it working by renaming
Got it working by renaming the path to 'user', then moved it to a customized menu. Thanks everyone!
Tecito.com
Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.
Thanks again
Yep, worked for us too..thanks!
Create an item with a path to "user"
There are some contributed modules that also have these locked menu items. They drive me crazy.
If you create a new menu item and assign
useras the path, Drupal will defer to it and the "my account" menu item will disappear from the Navigation block. As usual, clicking a link that points touserwill prompt a user to login, or redirect to his or her account if the user is already logged in. In this case, we're just putting a link like this into the Primary links.There problem I have with this, though, is that there's no way I've seen or thought of for renaming this menu item to something other than "My Account". If you name the new menu item to something like "Account" instead of "My Account", all it seems to change are the breadcrumbs you see when viewing an account.
I haven't tested this , but
I haven't tested this , but couldn't you change the My Account string to Account using the locale.module ?
Nope
That has never worked for me.
What I'd really like to see is a smarter "my account" menu item that says "login" when a user isn't logged in and then switches its name to "my account" after logging in. Does anyone know of a way to do this?
The login menu module adds a "Log in" menu item (which can be placed in the Primary links) and it disappears when a user is logged in. This is all it does but it does it well. Unfortunately, if placed in the Primary links alongside a "My Account" link, they both appear to anonymous users.
...
One is, make the menu block only visible to authenticated users. Then create a block with a log in (either menu or php snippet) and make that visible only to anonymous users.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
That's the thing
That's the thing, I'm not using blocks but rather the Primary links. Does your solution involve modifying Drupal's behavior at the theme level?
...
No but the code snippets the same if for anonymous users you just have a link to log on.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
OK, the problem I described in the last paragraph
OK, the problem I described in the last paragraph (the "there's no way I've seen or thought of for renaming this menu item" part) is not present in the latest 4.7.x-dev tarball. I was speaking from my experience of an older version of 4.7 that I set up a few months ago. It looks like this one was fixed, or perhaps it's just plaguing that particular installation.
This strange behaviour makes me mad
Hello,
In the site I have to build, we need one "Personal Space" block containing only links to "My account", "My blog", "My contributions", and another block containing links to content creation. I can't use Navigation menu because I need to rename it (and to keep it active for admin users), but I can't create menu entries linked to "my account" or to "my blog". Does anybody have a solution?
Thank you.
Sto
The answer is...
'me' aliases module !
It provides shortcut paths to current user's pages, eg user/me, blog/me, user/me/edit, tracker/me etc.
Agreed.
It's a fantastic module.
Putting 'My account' into the primary links in Drupal 5
The work around for this is to go into Administer --> Site Building --> Menu and then go into the 'Settings' tab.
Change the 'Menu containing primary links:' dropdown from 'Primary Links' to 'Navigation'. Save the changes and you'll see this will put the 'My account' locked menu into the primary links section of your site's theme without having to do any addition programming.
For instance, I have "My accounts' and "Log out' links at the top right of my garland theme but did not want any links in my primary section. Any other menu links in that original 'Navigation' menu were moved to a new menu I created from the 'Add Menu' tab. I then went to the Blocks section and added that new menu to my left hand bar with all my 'Navigation' links.
I hope this helps some people. I had been looking around for a solution for some time.
It's a good solution that
It's a good solution that what I need for a site.
But the logged in user name at the oridinal 'Navigation' block doens't show up any more.
How is it possible to display the name of the logged in user?
Thanks Jcarlson34! This is
Thanks Jcarlson34! This is the solution that I was looking for. This actually answered another one of my questions on how to add the secondary links bar as mine was missing it (using the Marinelli Theme).