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:

6 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
  5. This really is such a wonderful resource that youre offering and you give it away for free. I take pleasure in seeing sites that realize the worth of delivering a prime resource for no cost. I really loved reading your post. Thanks! web and mobile app development company

    ReplyDelete
  6. Is it true that you are searching for a Freezer van In UAE? We have numerous sorts in the UAE, from Freezer Trucks to Freezer Vans. We have different vehicles with various weight constrains that can take into account all your business needs! The most ideal approach to keep any thing sound and fresh is to verify in a temperature-controlled condition. Chiller truck for rent in Dubai

    ReplyDelete