hook_user_role_presave

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 hook_user_role_presave($role)

Inform other modules that a user role is about to be saved.

Modules implementing this hook can act on the user role object before it has been saved to the database.

Parameters

$role A user role object.

See also

hook_user_role_insert()

hook_user_role_update()

Related topics

Code

modules/user/user.api.php, line 381

<?php
function hook_user_role_presave($role) {
  // Set a UUID for the user role if it doesn't already exist
  if (empty($role->uuid)) {
    $role->uuid = uuid_uuid();
  }
}
?>