Skip navigation
Help

comment_access

6 comment.module comment_access($op, $comment)
7 comment.module comment_access($op, $comment)

Determines 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.

Parameters

$op: The operation that is to be performed on the comment. Only 'edit' is recognized now.

$comment: The comment object.

Return value

TRUE if the current user has acces to the comment, FALSE otherwise.

1 call to comment_access()

1 string reference to 'comment_access'

File

drupal/modules/comment/comment.module, line 1423
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->status == COMMENT_PUBLISHED && user_access('edit own comments')) || user_access('administer comments');
  }
}