function hook_user_role_delete

Inform other modules that a user role has been deleted.

This hook allows you act when a user role has been deleted. If your module stores references to roles, it's recommended that you implement this hook and delete existing instances of the deleted role in your module database tables.

Parameters

$role: The $role object being deleted.

Related topics

2 functions implement hook_user_role_delete()

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

block_user_role_delete in drupal/core/modules/block/block.module
Implements hook_user_role_delete().
user_user_role_delete in drupal/core/modules/user/user.module
Implements hook_user_role_delete().

File

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

Code

function hook_user_role_delete($role) {

  // Delete existing instances of the deleted role.
  db_delete('my_module_table')
    ->condition('rid', $role
    ->id())
    ->execute();
}