function userone_user in User One 6
Implementation of hook_user().
File
- ./
userone.module, line 70 - User One module.
Code
function userone_user($op, &$edit, &$account, $category = NULL) {
global $user;
// Access control to edit of user one account.
if ($op == 'form') {
if ($account->uid == 1 and $user->uid != 1) {
// Make sure access allowed roles are pulled from ones with 'administer users' permission.
$roles_access = userone_access_raw('edit');
$roles_access = array_intersect($roles_access, variable_get('userone_edit_access', userone_access_raw('edit')));
if (!(user_edit_access($account) and (bool) array_intersect($roles_access, array_keys($user->roles)))) {
drupal_goto('user');
}
}
}
else {
if ($op == 'view') {
if ($account->uid == 1 and $user->uid != 1) {
// Make sure access allowed roles are pulled from ones with 'access user profiles' permission.
$roles_access = userone_access_raw('view');
$roles_access = array_intersect($roles_access, variable_get('userone_view_access', userone_access_raw('view')));
if (!(user_view_access($account) and (bool) array_intersect($roles_access, array_keys($user->roles)))) {
drupal_goto('user');
}
}
}
}
}