Closed (fixed)
Project:
Basic
Version:
6.x-1.2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2009 at 21:31 UTC
Updated:
7 Feb 2011 at 04:33 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedOne alternative would be to remove the tabs on the account page, and replace them by custom links (in a block for example).The path of the user page is like this :
http://www.mysite.com/user/1
where 1 is the user ID. You can make this link in a template like this :
<?php echo l('View my account', 'user/' . $user->uid . '/edit') ;?>This will create a link showing the connected user name, linking to it's user page. Now knowing this, the 'edit account path is like this :
http://www.mysite.com/user/1/edit
So to build a dynamic link to edit the connected user's account, it's simple like this :
<?php echo l('Edit my account', 'user/' . $user->uid) ;?>By using this in a template or a block (with PHP format), you can drop these links wherever you want. You might have to use this in your block if this doesn't work :
<?php global $user ;?>Hope this helps
Comment #2
fishermanJeff commentedWhat template file would this php be added to? Thanks again.
Comment #3
Anonymous (not verified) commentedYou can drop it either in a block, that you can then drop in any region of your theme, but if you do that, you will still have the tabs showing up.
The best solution imhois to drop it in the page.tpl.php. You can make a condition that checks if the URL starts with 'user', and if yes, output your custom links, if no, just output the normal tabs.
So in your page.tpl.php, instead of :
use this:
Comment #4
fishermanJeff commentedTHANKS! That worked great!
Comment #5
stroem commentedThis also works for D5. Thanks a lot, man!
Comment #6
johnlee80 commentedIf I wanted to add this link to the Navigation menu, where would I the PHP code above?
Comment #7
Courtney.B commentedI encountered this problem while theming in Drupal 7 tonight using Basic 7.x-2.0-rc2. The code provided was not working for me but I successfully created a view to do the same thing.
I have attached a copy of the view - it's very simple to set-up:
1) Add new view; View Type = User
2) Filter = User: Current Yes
3) Field = User: Edit Link
I placed the block in the dashboard and magic! I'm adding some other links to make it a more robust user menu. I hope this helps. :)