comment_access

Versions
4.6 – 7
comment_access($op, $comment)

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.

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 function calls comment_access()

comment_links in modules/comment/comment.module
Helper function, build links for an individual comment.

Code

modules/comment/comment.module, line 1234

<?php
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');
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.