Full ELMS Learning Network documentation
function comment_access
cis7 comment.module | comment_access($op, $comment) |
cle7 comment.module | comment_access($op, $comment) |
elmsmedia7 comment.module | comment_access($op, $comment) |
icor7 comment.module | comment_access($op, $comment) |
meedjum_blog7 comment.module | comment_access($op, $comment) |
mooc7 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.
4 calls to comment_access()
- comment_links in modules/
comment/ comment.module - Helper function, build links for an individual comment.
- email_mail_page_access in sites/
all/ modules/ ulmus/ email/ email.module - Access callback for the email contact page.
- entity_metadata_comment_access in sites/
all/ modules/ ulmus/ entity/ modules/ callbacks.inc - Access callback for the comment entity.
- views_handler_field_comment_link_edit::render_link in sites/
all/ modules/ ulmus/ views/ modules/ comment/ views_handler_field_comment_link_edit.inc
3 string references to 'comment_access'
- comment_menu in modules/
comment/ comment.module - Implements hook_menu().
- comment_views_data in sites/
all/ modules/ ulmus/ views/ modules/ comment.views.inc - og-7.x-1.x.database.php in sites/
all/ modules/ ulmus/ og/ tests/ og-7.x-1.x.database.php - Filled installation of Drupal 7.0, for test purposes.
File
- modules/
comment/ comment.module, line 1439 - 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');
}
}