hook_user_role_update

function hook_user_role_update

hook_user_role_update($role)

Respond to updates to a user role.

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

File

modules/user/user.api.php, line 447
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();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.api.php/function/hook_user_role_update/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部