You are here

function comment_perm_comment_presave in Comment Permissions 7.2

Implements hook_comment_presave().

File

./comment_perm.module, line 222
Control commenting permissions by role and by node type.

Code

function comment_perm_comment_presave($comment) {
  $node = node_load($comment->nid);

  // Re-write comment status based on user permission for current node type.
  if (comment_perm_active_type($node->type)) {
    $comment_status = COMMENT_NOT_PUBLISHED;
    if (comment_perm_skip_approval_access($node) || comment_perm_administer_access($node)) {
      $comment_status = COMMENT_PUBLISHED;
    }
    $comment->status = $comment_status;
  }
}