I'm making a custom user-profile.tpl.php page and want to put the "business name" field where the Title/Username normally occurs and print the username elsewhere.

The username doesn't appear in the list at: Administration » Configuration » People » Account settings » Manage Display so I can't remove it there.

My guess is that I need to add some logic to page.tpl.php to not print it on user profiles and then I need to know the variable to add it to user-profile.tpl.php.

Can anyone help me with this?

3 Answers 3


You can do it by disable field display property using form_alter

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'FORM_ID') {
  $form['account']['your_field_name']['#access'] = FALSE;

1) Create a custom module

2) Put this code:

function formalter_form_alter(&$form, &$form_state, $form_id){
  switch ($form_id) {    
    case 'user_profile_form':
        $form['account']['name']["#attributes"]['placeholder']=t('Bussiness  Name');

Thanks for the responses. I approached it differently.

I first created a custom page--user.tpl.php file in which I removed the section that prints the title.

I then found the username variable and wrote a little snippet to print it under the business name (except in cases where the business name doesn't exist) in user-profile.tpl.php.


$user_username = $variables['elements']['#account']->name;

if (isset($user_profile['field_business_name']) || array_key_exists('field_business_name', $user_profile)) { 

$user_business_name = $user_profile['field_business_name']['#items'][0]['safe_value'];
print "<h1>$user_business_name</h1>";
print "<b>$user_username</b>";
print "<br>";


print "<h1>$user_username</h1>";
print "<br>";


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.