You are here

function pathauto_user_update_alias in Pathauto 6.2

Same name and namespace in other branches
  1. 6 pathauto.module \pathauto_user_update_alias()
  2. 7 pathauto.module \pathauto_user_update_alias()

Update the URL aliases for an individual user account.

Parameters

$account: A user account object.

$op: Operation being performed on the account ('insert', 'update' or 'bulkupdate').

$options: An optional array of additional options.

3 calls to pathauto_user_update_alias()
pathauto_user in ./pathauto.module
Implements hook_user().
pathauto_user_update_action in ./pathauto.module
Update action wrapper for pathauto_user_update_alias().
pathauto_user_update_alias_multiple in ./pathauto.module
Update the URL aliases for multiple user accounts.

File

./pathauto.module, line 727
Main file for the Pathauto module, which automatically generates aliases for content.

Code

function pathauto_user_update_alias($account, $op, $options = array()) {

  // Skip processing if the user has disabled pathauto for the account.
  if (isset($account->pathauto_perform_alias) && empty($account->pathauto_perform_alias) && empty($options['force'])) {
    return;
  }
  $options += array(
    'alias blog' => module_exists('blog'),
    'language' => '',
  );

  // Skip processing if the account has no pattern.
  if (!pathauto_pattern_load_by_entity('user', '', $options['language'])) {
    return;
  }
  module_load_include('inc', 'pathauto');
  pathauto_create_alias('user', $op, "user/{$account->uid}", array(
    'user' => $account,
  ), $account->uid, NULL, $options['language']);

  // Because blogs are also associated with users, also generate the blog paths.
  if (!empty($options['alias blog'])) {
    pathauto_blog_update_alias($account, $op);
  }
}