function view_profiles_perms_access in View profiles permissions 6
Same name and namespace in other branches
- 7 view_profiles_perms.module \view_profiles_perms_access()
Access callback for user profiles.
1 string reference to 'view_profiles_perms_access'
- view_profiles_perms_menu_alter in ./
view_profiles_perms.module - Implements hook_menu_alter().
File
- ./
view_profiles_perms.module, line 46 - Restricts viewing user profiles based on user roles
Code
function view_profiles_perms_access($account) {
// First check user module's access
$access = user_view_access($account);
if (!$access) {
// Check our own permissions.
foreach ($account->roles as $rid => $role_name) {
// Annonymous and authenticated user roles get skipped
if ($rid == 1 || $rid == 2) {
continue;
}
$perm_name = view_profiles_perms_permission_name($role_name);
$access = user_access($perm_name);
if ($access == TRUE) {
break;
}
}
}
return $access;
}