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.

CommentFileSizeAuthor
SDC10394.JPG588.44 KBrockwright
SDC10392.JPG585.9 KBrockwright

Comments

hefox’s picture

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).

function 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;
	}
}
rockwright’s picture

Would the above code go into template.php?

hefox’s picture

oops, yes it would

rockwright’s picture

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.

hefox’s picture

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

ryan osītis’s picture

Version: 6.x-2.0-alpha1 » master
Issue summary: View changes
Status: Active » Closed (outdated)