Skip navigation
Help

hook_user_role_update

7 user.api.php hook_user_role_update($role)

Inform other modules that a user role has been updated.

Modules implementing this hook can act on the user role object when updated. It's recommended that you implement this hook if your module adds additional data to user roles object. The module should save its custom additions to the database.

Parameters

$role: A user role object.

Related topics

1 invocation of hook_user_role_update()

File

drupal/modules/user/user.api.php, line 420
Hooks provided by the User module.

Code

function hook_user_role_update($role) {
  // Save extra fields provided by the module to user roles.
  db_merge('my_module_table')
    ->key(array('rid' => $role->rid))
    ->fields(array(
    'role_description' => $role->description,
  ))
    ->execute();
}