You are here

function pathauto_user_update_alias in Pathauto 6

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

Update the URL aliases for an individual user account.

@todo Remove support for any sub-path aliases.

Parameters

$account: A user account object.

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

1 call to pathauto_user_update_alias()
pathauto_user_update_alias_multiple in ./pathauto.module
Update the URL aliases for multiple user accounts.

File

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

Code

function pathauto_user_update_alias($account, $op) {
  module_load_include('inc', 'pathauto');
  $placeholders = pathauto_get_placeholders('user', $account);
  pathauto_create_alias('user', $op, $placeholders, "user/{$account->uid}", $account->uid);
  if (module_exists('blog')) {
    if (node_access('create', 'blog', $account)) {
      pathauto_create_alias('blog', $op, $placeholders, "blog/{$account->uid}", $account->uid);
    }
    else {
      path_set_alias('blog/' . $user->uid);
      path_set_alias('blog/' . $user->uid . '/feed');
    }
  }
  if (module_exists('tracker')) {
    $alias = pathauto_create_alias('tracker', $op, $placeholders, "user/{$account->uid}/track", $user->uid);
  }
  if (module_exists('contact')) {
    $alias = pathauto_create_alias('contact', $op, $placeholders, "user/{$account->uid}/contact", $user->uid);
  }
}