You are here

function page_title_user_update in Page Title 7

Same name and namespace in other branches
  1. 8.2 page_title.module \page_title_user_update()
  2. 7.2 page_title.module \page_title_user_update()

Implement hook_user_update().

File

./page_title.module, line 323
Enhanced control over the page title (in the head tag).

Code

function page_title_user_update(&$edit, &$account, $category) {
  if (user_access('set page title')) {
    if (isset($edit['page_title']) && drupal_strlen(trim($edit['page_title'])) > 0) {
      db_merge('page_title')
        ->key(array(
        'type' => 'user',
        'id' => $account->uid,
      ))
        ->fields(array(
        'page_title' => $edit['page_title'],
      ))
        ->execute();
    }
    else {
      db_delete('page_title')
        ->condition('type', 'user')
        ->condition('id', $account->uid)
        ->execute();
    }
  }
}