You are here

function comment_perm_link_alter in Comment Permissions 6

Same name and namespace in other branches
  1. 5 comment_perm.module \comment_perm_link_alter()

Implementation of hook_link_alter().

File

./comment_perm.module, line 118
Module to control commenting permissions by role and by node type.

Code

function comment_perm_link_alter(&$links, $node) {
  if (!comment_perm_access($node)) {
    unset($links['comment_add']);
    if (module_exists('quote')) {
      unset($links['quote']);
    }

    // hide comments links entirely if that setting is enabled
    if (variable_get('comment_perm_hide_comments', 0)) {
      unset($links['comment_comments']);
      unset($links['comment_new_comments']);
    }
  }
}