function hook_user_role_presave

Act on a user role being inserted or updated.

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

1 invocation of hook_user_role_presave()
user_role_save in modules/user/user.module
Save a user role to the database.

File

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

Code

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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.