function hook_user_role_insert

Inform other modules that a user role has been added.

Modules implementing this hook can act on the user role object when saved to the database. 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 function implements hook_user_role_insert()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

user_user_role_insert in drupal/core/modules/user/user.module
Implements hook_user_role_insert().

File

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

Code

function hook_user_role_insert($role) {

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