1

I've created a custom module called renameprofile to alter the title on my user page, but it doesn't seem to be working. Any idea what is causing this issue? Btw this is on the ?q=user page.

renameprofile.module

<?php
function renameprofile_page_alter() {  

  global $user;  

  if(drupal_get_title() === isset($user->name)) {  
    drupal_set_title('My Sharecab');  
  }  
}
?>

renameprofile.info

name = Rename user profile page title
description = This module renames the profile page title
core = 7.x

1 Answer 1

2

Yeah, that's an odd approach with === isset() basically checking if drupal_get_title == TRUE; whereas drupal_get_title returns a string title.

Something like this should work, in template.php or module (clear cache).

It will set the $title variable for page.tpl.php

/**
 * Implements hook_preprocess_page
 */
function MODULE_preprocess_page(&$variables){
  // Set title on user account pages.
  if ($account = menu_get_object('user')) {
    $variables['title'] = t('My Sharecab');
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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