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 their posts got. Furthermore, users can't reply to their own comments and are encouraged instead to extend their original comment.
Code
modules/comment.module, line 344
<?php
function comment_access($op, $comment) {
global $user;
if ($op == 'edit') {
return $user->uid && $user->uid == $comment->uid && comment_num_replies($comment->cid) == 0;
}
}
?>Login or register to post comments 