function comment_goodness_delete_comment_access in Comment goodness 7
Access callback for deleting own comment.
1 call to comment_goodness_delete_comment_access()
- comment_goodness_comment_view in ./
comment_goodness.module - Implements hook_comment_view().
1 string reference to 'comment_goodness_delete_comment_access'
- comment_goodness_menu in ./
comment_goodness.module - Implements hook_menu().
File
- ./
comment_goodness.module, line 243 - Comment goodness provides newest to oldest comment sorting
Code
function comment_goodness_delete_comment_access($comment) {
global $user;
$access = $user->uid && $user->uid == $comment->uid && $comment->status == COMMENT_PUBLISHED && (user_access('delete own comments') || 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();
}