home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (user.page_title.inc)

This example Drupal source code file (user.page_title.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

arg, args, blog, elseif, function, if, is_numeric, pattern, php, types, user, user_page_title_alter, user_page_title_pattern_alter, user_title

The user.page_title.inc Drupal example source code

<?php
// $Id: user.page_title.inc,v 1.1.4.2 2010/08/25 14:33:30 njt1982 Exp $

/**
 * @file
 * User implementations of the page title hooks
 */


/**
 * Implementation of hook_page_title_alter().
 */
function user_page_title_alter(&$title) {
  // If we're looking at either a user profile page or a users blog page, get the user title
  if ((arg(0) == 'user' || arg(0) == 'blog') && is_numeric(arg(1))) {
    if (variable_get('page_title_user_showfield', 0) && ($user_title = page_title_load_title(arg(1), 'user'))) {
      $title = $user_title;
    }
  }
}


/**
 * Implementation of hook_page_title_pattern_alter().
 */
function user_page_title_pattern_alter(&$pattern, &$types) {
  // User
  if (arg(0) == 'user' && is_numeric(arg(1))) {
    $types['user'] = user_load(array('uid' => arg(1)));
    $pattern = variable_get('page_title_user', '');
  }
  // Blog
  elseif (arg(0) == 'blog' && is_numeric(arg(1))) {
    $types['user'] = user_load(array('uid' => arg(1)));
    $pattern = variable_get('page_title_blog', '');
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal user.page_title.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.