function comment_access

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.

Drupal\comment\Comment $comment: The comment object.

Return value

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

2 calls to comment_access()
comment_links in drupal/core/modules/comment/comment.module
Adds reply, edit, delete, etc. links, depending on user permissions.
LinkEdit::render_link in drupal/core/modules/comment/lib/Drupal/comment/Plugin/views/field/LinkEdit.php
2 string references to 'comment_access'
comment_menu in drupal/core/modules/comment/comment.module
Implements hook_menu().
comment_views_data in drupal/core/modules/comment/comment.views.inc
Implements hook_views_data().

File

drupal/core/modules/comment/comment.module, line 1389
Enables users to comment on published content.

Code

function comment_access($op, Comment $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');
  }
}