Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
b1d7222c
Commit
b1d7222c
authored
Jan 31, 2009
by
Angie Byron
Browse files
#352337
by catch: Avoid pager query if there are no comments on a node.
parent
6cbf7424
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/comment/comment.module
View file @
b1d7222c
...
...
@@ -1078,10 +1078,12 @@ function comment_render($node, $cid = 0) {
$output
.
=
theme
(
'comment_view'
,
$comment
,
$node
,
$links
);
}
}
// Only attempt to render comments if the node has been commented upon.
else
{
// Only attempt to render comments if the node has visible comments.
// Unpublished comments are not included in $node->comment_count, so show
// comments unconditionally if the user is an administrator.
elseif
(
$node
->
comment_count
||
user_access
(
'administer comments'
))
{
//TODO Convert to dynamic queries once the pager query is updated to the new DBTNG API.
//
TODO
:
Convert to dynamic queries once the pager query is updated to the new DBTNG API.
// Multiple comment view.
$query_count
=
'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d'
;
...
...
modules/comment/comment.pages.inc
View file @
b1d7222c
...
...
@@ -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'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment