diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 852666a..12619c8 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -934,46 +934,36 @@ function comment_view(Comment $comment, $view_mode = 'full', $langcode = NULL) { function comment_links(Comment $comment, Node $node) { $links = array(); if ($node->comment == COMMENT_NODE_OPEN) { - if (user_access('administer comments') && user_access('post comments')) { + if ($comment->access('delete')) { $links['comment-delete'] = array( 'title' => t('delete'), 'href' => "comment/{$comment->id()}/delete", 'html' => TRUE, ); - $links['comment-edit'] = array( - 'title' => t('edit'), - 'href' => "comment/{$comment->id()}/edit", - 'html' => TRUE, - ); - $links['comment-reply'] = array( - 'title' => t('reply'), - 'href' => "comment/reply/{$comment->nid->target_id}/{$comment->id()}", - 'html' => TRUE, - ); - if ($comment->status->value == COMMENT_NOT_PUBLISHED) { - $links['comment-approve'] = array( - 'title' => t('approve'), - 'href' => "comment/{$comment->id()}/approve", - 'html' => TRUE, - 'query' => array('token' => drupal_get_token("comment/{$comment->id()}/approve")), - ); - } } - elseif (user_access('post comments')) { - if ($comment->access('update')) { + if ($comment->access('update')) { $links['comment-edit'] = array( 'title' => t('edit'), 'href' => "comment/{$comment->id()}/edit", 'html' => TRUE, ); - } + } + if ($comment->access('create')) { $links['comment-reply'] = array( 'title' => t('reply'), 'href' => "comment/reply/{$comment->nid->target_id}/{$comment->id()}", 'html' => TRUE, ); } - else { + if ($comment->status->value == COMMENT_NOT_PUBLISHED && $comment->access('approve')) { + $links['comment-approve'] = array( + 'title' => t('approve'), + 'href' => "comment/{$comment->id()}/approve", + 'html' => TRUE, + 'query' => array('token' => drupal_get_token("comment/{$comment->id()}/approve")), + ); + } + if (empty($links)) { $links['comment-forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node)); $links['comment-forbidden']['html'] = TRUE; }