You are here

function comment_perm_access in Comment Permissions 5

Same name and namespace in other branches
  1. 6 comment_perm.module \comment_perm_access()
  2. 7.2 comment_perm.module \comment_perm_access()
  3. 7 comment_perm.module \comment_perm_access()

Can the current user add comments to a given node?

3 calls to comment_perm_access()
comment_perm_comment in ./comment_perm.module
Implementation of hook_comment().
comment_perm_form_alter in ./comment_perm.module
Implementation of hook_form_alter().
comment_perm_link_alter in ./comment_perm.module
Implementation of hook_link_alter().

File

./comment_perm.module, line 158

Code

function comment_perm_access($node) {
  if (is_numeric($node)) {
    $node = node_load($node);
  }

  // get node types managed by comment_perm
  $types = variable_get('comment_perm_node_types', array());
  if ($types[$node->type]) {
    if (!user_access('comment on ' . $node->type . ' content')) {
      return false;
    }
  }
  return true;
}