I need to change what the "Edit" tab says on in the account section but can't figure out how to do this. It needs to say "Edit my account". I've tried the string overrides (http://drupal.org/project/stringoverrides) module but that changes all the tabs that say "edit". I've seen tutorials how to do this for drupal 5, but not for drupal 6 which is what I'm using. Any help is welcome.

CommentFileSizeAuthor
#7 view_edit_account.txt4.01 KBCourtney.B

Comments

Anonymous’s picture

Category: task » support

One 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

fishermanJeff’s picture

What template file would this php be added to? Thanks again.

Anonymous’s picture

You 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 :

		        			<?php if ($tabs): ?>
		        			  <div class="tabs"><?php echo $tabs; ?></div>
		        			<?php endif; ?>

use this:

<?php 
   $url = explode('/', $_SERVER['REQUEST_URI']);
   if ($tabs && $url[1] != "user"): ?>
    <div class="tabs"><?php echo $tabs; ?></div>
<?php else : ?>
  <?php echo l('View my account', 'user/' . $user->uid) ;?>
  <?php echo l('Edit my account', 'user/' . $user->uid . '/edit') ;?>
<?php endif; ?>
fishermanJeff’s picture

Status: Active » Closed (fixed)

THANKS! That worked great!

stroem’s picture

This also works for D5. Thanks a lot, man!

johnlee80’s picture

If I wanted to add this link to the Navigation menu, where would I the PHP code above?

Courtney.B’s picture

StatusFileSize
new4.01 KB

I 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. :)