I really enjoy the functionality that logintoboggan provides. One request I do have would be to change the username that is displayed in the "LoginToboggan logged in block" from static text to a link to the user's my account page.


EvanDonovan’s picture

Status: Active » Needs review

You can easily do this using a theming function such as

function your-theme_lt_loggedinblock(){
  global $user;
  return l(check_plain($user->name), 'user/' . $user->uid) .' | ' . l(t('Log out'), 'logout');

Note that the code given above is untested. It should work, though, after you add it to your theme's template.php file & rebuild the theme registry (which you can do by visiting admin/build/themes).

However, I would suggest you consider that this change might make it more difficult for people to click logout, since they might click their username by mistake.

(Unrelated: was my reply the first 4th of July post in Drupal's timezone? I'll have to check...)

pipicom’s picture

Thanks EvanDonovan..

kbell’s picture

I agree, however, that this is one of the several mods I have to use every time I use logintoboggan - from a usability standpoint, it's what users expect, and I would love to not have to add this custom to every site I do :-)

Thank you for a wonderful module.

hunmonk’s picture

Version: 6.x-1.5 » 7.x-1.x-dev
Status: Needs review » Active

i've decided to implement this in 7.x. for 6.x and below, please use the approach outlined in #1.

hunmonk’s picture

Title: Link username to my account page » Link username to my account page in logged in block
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

abaddon’s picture

no need for check_plain, its already done by default in l(), http://drupal.org/node/28984
however, it should be more like this

function THEMENAME_lt_loggedinblock() {
        global $user ;
        return theme('username', $user) .' | ' . l(t('Log out'), 'logout') ;

same result..

Tino’s picture

Just what I was looking for. Thanks!

tallsimon’s picture

what a shame you don't want to implement this for drupal v6. I use a subtheme which cannot be subthemed (an acquia fusion subtheme) so adding code to the template is not so straightforward, have to remove parent template and write one for subtheme or modify parent theme template.
but glad it will be in v 7, good work.

abaddon’s picture

@tallsimon, im in the same situation now, i dont want to hack the theme, so..

 * Implementation of hook_theme_registry_alter().
function sitemodule_theme_registry_alter(&$theme_registry) {
        if ( ! empty($theme_registry['lt_loggedinblock'])) {
                $theme_registry['lt_loggedinblock']['function'] = 'sitemodule_theme_lt_loggedinblock';

function sitemodule_theme_lt_loggedinblock() {
        global $user ;
        return theme('username', $user) . ' | ' . l(t('Log out'), 'logout') ;