Profile2 , change page title With profile2 all the profile page titles is the profile type.

How do I override it with a field from profile2?

I was wondering something like this

hook_preprocess_page(&amp;$variables){
if ($page-type == profile2) {
$new_title = field_get_items('profile2', $profile, 'field_new_title');

  drupal_set_title($new_title);
}
}


Of course this script does not work.

This needs to happen just on the profile page, not in the profile listing page.
To change the content title (defaults to the username) you can use this snippet in a custom module:

&lt;?php
function MYMODULE_custom_menu_alter(&amp;$items) {
 $items['user/%user']['title callback'] = MYMODULE_user_page_title;
}

function MYMODULE_user_page_title() {

if(arg(0) == 'user') {
// Load uid from url
$user = user_load(arg(1));
// Load profile2 entity
$profile2 = profile2_load_by_user($user-&gt;uid);
// Load fields
$myfield = field_get_items('profile2', $profile2['main'], 'field_myfield');
$output = $myfield[0]['safe_value'];
}

// Fallback to username if no fields are present
if(empty($output)) {
   $output = $user-&gt;name;
 }

return $output;

}
?&gt;


Reference : http://drupal.org/node/1262070, Change page title on user-profile using a field value from Profile2