Bil*_*lal 2 php drupal drupal-7 drupal-modules
我想获得用户角色就像使用它获取节点类型一样
node_type_get_types();
Run Code Online (Sandbox Code Playgroud)
无论如何使用这样的函数来获取用户角色?
小智 7
如果要检查当前用户的特定角色(在此示例中,我们使用"authenticated user"):
global $user;
if (in_array('authenticated user', $user->roles)){
//do stuff
}
Run Code Online (Sandbox Code Playgroud)