function comment_perm_administer_access in Comment Permissions 7
Same name and namespace in other branches
- 7.2 comment_perm.module \comment_perm_administer_access()
Control access for users with administer comments permissions.
1 call to comment_perm_administer_access()
- comment_perm_form_alter in ./
comment_perm.module - Implementation of hook_form_alter().
File
- ./
comment_perm.module, line 289 - Module to control commenting permissions by role and by node type.
Code
function comment_perm_administer_access($node) {
global $user;
$types = variable_get('comment_perm_node_types', array());
if (isset($types[$node->type])) {
$access_all = user_access($node->type . ': administer comment settings on any ' . $node->type . ' content');
$access_own = user_access($node->type . ': administer comment settings on own ' . $node->type . ' content');
// User has access to administer comments for current type of content.
if ($access_all) {
return TRUE;
}
// User has access to administer comments on own content.
if ($access_own && $user->uid == $node->uid) {
return TRUE;
}
}
return FALSE;
}