[support] Creating a "My Account" Link that Goes to user/<uid>/edit

Domenic Santangelo domenics at gmail.com
Sun Jan 3 21:55:43 UTC 2010


On Jan 3, 2010, at 12:19 PM, Shai Gluskin wrote:

> Steve and Mike,
> 
> Thanks so much for responding. I'm going to use that simple
> work-around that Steve pointed. Maybe not the most elegant, but
> certainly fast and maintainable.
> 
> Shai
> 
> On Sun, Jan 3, 2010 at 2:59 PM,  <skessler at denverdataman.com> wrote:
>> I thought I had done this before but I guess not - I found this on the
>> forums when I was looking - http://drupal.org/node/102162

Hey Shai,

That forum page is a little out of date -- if you're using D6:

In template.php:

function mytheme_preprocess_page(&$vars) { //See http://api.drupal.org/api/function/template_preprocess_page/6
  global $user;
  //other stuff...
  $vars['edit_profile_link'] = $user->uid ? l(t("Edit my profile"), "user/" . $user->uid . "/edit") : NULL;
}

In page.tpl.php:

if($edit_profile_link) {
  print $edit_profile_link;
}

You could technically put all of that in page.tpl.php, but for separation of concerns do it this way. I've added this to the forum page as well.

Hope this helps!

-D


More information about the support mailing list