Title change
rockwright - July 28, 2009 - 19:17
| Project: | Invite |
| Version: | 6.x-2.0-alpha1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi,
I’m looking for a way to change the title of the invitation page in the profile page from “My Account” to the user’s username as shown in the attachments. Can this be done by views or would I need to modify the code? Thank you for the support.
| Attachment | Size |
|---|---|
| SDC10392.JPG | 585.9 KB |
| SDC10394.JPG | 588.44 KB |

#1
I've had to do something similiar, in the end I ended up overiding it in the theme
here's a code snippit (needed it on several pages).
<?phpfunction themename_preprocess_page(&$vars) {
$uid = arg(1);
if (arg(0)=='user' && $uid && is_numeric($uid) && $account = user_load($uid)) {
// due the various setting of drupal_set_title need to manually override the title for user pages.
$title_save= $vars['title'] ;
$new_title = $account->name;
// setting the browser title
$vars['head_title'] = $new_title . ' | ' . $vars['site_name'];
// setting the page title
$vars['title'] = $new_title;
}
}
?>
#2
Would the above code go into template.php?
#3
oops, yes it would
#4
You said you needed the snippet in several pages, what pages would those be? I tried inserting that code in the template file but it still didn't render what I wanted.
#5
Hm, weird I have it working on two pages. What base them you using? Did you change themename to your theme's name?
On mine it changes the title of anything with the url user//
ie
user/1/edit
user/1/view (aka user/1)
user/1/notifications
user/1/invite
user/1/contact