function _user_revision_access in User Revision 7
Same name and namespace in other branches
- 7.2 user_revision.module \_user_revision_access()
Access callback.
1 string reference to '_user_revision_access'
- user_revision_menu in ./
user_revision.module - Implements hook_menu().
File
- ./
user_revision.module, line 90 - Enables user revision.
Code
function _user_revision_access($u, $perm) {
global $user;
if (!is_array($perm)) {
$perm = array(
$perm,
);
}
$access = FALSE;
foreach ($perm as $permission) {
if ($u->uid == $user->uid) {
$access = user_access($permission) || $access;
}
elseif (strpos($permission, 'own') === FALSE) {
$access = user_access($permission) || $access;
}
}
$count = db_select('user_revision', 'ur')
->condition('ur.uid', $u->uid)
->countQuery()
->execute()
->fetchField();
return $access && $count > 1;
}