hook_page_alter to change title on user profile page? Right now I have the following function implemented in template.php:

function ccom_page_alter(&amp;$page) {
  if (array_key_exists('#account',$page['content']['system_main'])) {
    $account = $page['content']['system_main']['#account'];

    if (isset($account)) {
      drupal_set_title($account-&gt;field_complete_name['und'][0]['safe_value']);
    }
  }
}


Is this the best way to set the title on a user page?  Or should I be doing this through a different hook?

EDIT: I've updated my template.php to use hook_preprocess_user_profile instead, and I have this:

function ccom_preprocess_user_profile(&amp;$variables) {
  drupal_set_title($variables['elements']['#account']-&gt;field_complete_name[LANGUAGE_NONE][0]['safe_value']);
}


The page title changes (like the one the browser shows you on a tab), but the user profile Drupal page title remains the username.  Very annoying.  Still working...

EDIT 2: I ran an experiment.  I did the following:

function ccom_preprocess(&amp;$variables, $hook) {
  dpm($hook);
}


Which gave the following output when viewing a user profile page:


search_block_form
block
region
block
region
user_profile
user_profile_item
user_profile_category
block
region
html
region
user_picture
page


So that's the order in which the preprocess hooks are called on that page.  I then created two functions:

function ccom_preprocess_user_profile(&amp;$variables) {
  dpm($variables);
  drupal_set_title('mytitle');
}

function ccom_preprocess_page(&amp;$variables) {
  dpm($variables);
  drupal_set_title('mytitle');
}


I first loaded the page with the ccom_preprocess_page function commented out.  The title in the browser tab changed to mytitle, but the page title stayed as the username for the user profile page being viewed.

I then commented out ccom_preprocess_user_profile and uncommented ccom_preprocess_page and reloaded the page again.  Both the browser tab title and the page title changed to mytitle.

This tells me that somewhere after the user_profile preprocess hook function and up to and including the page preprocess hook, the page title is reset.  Where that is I'm not entirely sure.

So, my thinking at this point would be to create a global variable and set it equal to the user account object available in the user_profile hook, and then in the page preprocess hook just set the title based on the complete name field available in the account object.  Thoughts?
This finally worked for me; it's essentially what was posted at http://drupal.org/node/1262070#comment-5038516, but with some function renaming and generalizing:

function YOUR_MODULE_menu_alter(&amp;$items) {
    // Change the title of user profile pages to the user's name.  Gak.
    $items['user/%user']['title callback'] = 'YOUR_MODULE_user_page_title';
}


and then

function YOUR_MODULE_user_page_title() {
    if (arg(0) == 'user') {
        // Load uid from url
        $user = user_load(arg(1));
        // Get the full user name somehow; here, I'm calling a function of my own.
        $output = get_user_full_name($user);
    }
    // Fallback to username if no fields are present
    if (empty($output)) {
        $output = $user-&gt;name;
    }
    return $output;
}


But, come on.  It's nice that the hooks are there, but doing something like setting the title of a page REALLY shouldn't be this hard/obscure...