Thursday, August 28, 2014

Rename My Account to Login Username

In Drupal 7, after user login then the user menu "My Account" and "Logout" links appear at the right corner.  This would be better if  I can change the link "My Account" to the login username.


This is the default:

And this is what I want:

STEP 1: Open user.module file
The user.module file can be found in folder /modules/user

STEP 2: Change the code
from:

function user_menu_title() {
  return user_is_logged_in() ? t('My Account') : t('User account');
}


to:
function user_menu_title() {
  return user_is_logged_in() ? $GLOBALS['user']->name : t('User account');
}


another method can be found here:

4 comments:

  1. like it.. also the reference (another method)

    ReplyDelete
  2. In Drupal 7.31 the function user_menu_title() is on line 2009

    ReplyDelete
  3. we have a Great collection, very beautiful and gorgeous weeding dress, looking nice also we offer
    bridal lace for weeding dress.

    ReplyDelete
  4. we have a Great collection, very beautiful and gorgeous weeding dress, looking nice also we offer
    bridal lace for weeding dress.

    ReplyDelete