summaryrefslogtreecommitdiff
path: root/modules/comment/comment.pages.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-31 16:19:29 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-01-31 16:19:29 +0000
commitb1d7222c6b003490dda7f45a92fe80737ba1c129 (patch)
tree85b62485c3bb54248fa2d7725ad376884fd752fd /modules/comment/comment.pages.inc
parent6cbf7424a0c40228ec06428ef201039bd1ffbe72 (diff)
downloadbrdo-b1d7222c6b003490dda7f45a92fe80737ba1c129.tar.gz
brdo-b1d7222c6b003490dda7f45a92fe80737ba1c129.tar.bz2
#352337 by catch: Avoid pager query if there are no comments on a node.
Diffstat (limited to 'modules/comment/comment.pages.inc')
-rw-r--r--modules/comment/comment.pages.inc12
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc
index 12d30cec8..dd88ad514 100644
--- a/modules/comment/comment.pages.inc
+++ b/modules/comment/comment.pages.inc
@@ -124,15 +124,13 @@ function comment_reply($node, $pid = NULL) {
*/
function comment_approve($cid) {
// Load the comment whose cid = $cid
- if ($comment = comment_load($cid)) {
- $operations = comment_operations('publish');
- $query = $operations['publish'][1];
- $query
- ->condition('cid', $cid )
- ->execute();
+ if ($comment = (array) comment_load($cid)) {
+ $comment['status'] = COMMENT_PUBLISHED;
+ $comment['comment_format'] = $comment['format'];
+ comment_save($comment);
drupal_set_message(t('Comment approved.'));
- drupal_goto("node/$comment->nid");
+ drupal_goto('node/' . $comment['nid']);
}
else {
drupal_set_message(t('The comment you are approving does not exist.'), 'error');