You are here

function comment_access in Drupal 4

Same name and namespace in other branches
  1. 5 modules/comment/comment.module \comment_access()
  2. 6 modules/comment/comment.module \comment_access()
  3. 7 modules/comment/comment.module \comment_access()

This is *not* a hook_access() implementation. This function is called to determine whether the current user has access to a particular comment.

Authenticated users can edit their comments as long they have not been replied to. This prevents people from changing or revising their statements based on the replies to their posts.

2 calls to comment_access()
comment_edit in modules/comment.module
comment_links in modules/comment.module

File

modules/comment.module, line 442
Enables users to comment on published content.

Code

function comment_access($op, $comment) {
  global $user;
  if ($op == 'edit') {
    return $user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0 || user_access('administer comments');
  }
}