You are here

function better_comments_delete_access in Better Comments 7.2

Same name and namespace in other branches
  1. 7 better_comments.module \better_comments_delete_access()

Access callback for deleting own comment.

1 call to better_comments_delete_access()
better_comments_comment_view in ./better_comments.module
Implements hook_comments_comment_view().

File

./better_comments.module, line 511
Better Comments provides option to configure the comment system.

Code

function better_comments_delete_access($comment) {
  global $user;
  $access = $user->uid && $user->uid == $comment->uid && $comment->status == COMMENT_PUBLISHED && (user_access('delete own comment') || user_access('administer comments'));

  // Deletion is not allowed if any comment has this comment as a parent.
  return $access && 0 == db_query("SELECT COUNT(cid) FROM {comment} WHERE pid = :cid", array(
    ':cid' => $comment->cid,
  ))
    ->fetchField();
}