In 6.x, we added a feature so that hook_db_rewrite_sql() could be used to restrict the comments shown in comment_render(). http://drupal.org/node/216504 fixes critical bugs with this feature, however there are a couple other stragglers.

One of them is that the queries in comment_num_all() and comment_num_new() /aren't/ run through db_rewrite_sql, which results in a user seeing "3 comments / 1 new comment" but then clicking in and only seeing one old one, for example.

I didn't mark this one critical, because it's not spewing SQL errors like the other referenced one, but it still makes the db_rewrite_sql() feature pretty useless without it.

Comments

ged3000’s picture

Is this soon to be irrelevant, because of Replace db_rewrite_sql() with hook_query_alter()? (For 7.x, at any rate)

Also, comment_num_all() is no longer used in 7.x. When the number of comments is loaded in comment_render, db_rewrite_sql() is called:

$query_count = 'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d';
...
$query_count = db_rewrite_sql($query_count, 'c', 'cid');

API entry.

Similarly for comment_get_recent() not run through db_rewrite_sql()

Postpone this issue?

davyvdb’s picture

Status: Active » Needs review

This is irrelevant now I guess too.

cburschka’s picture

Status: Needs review » Closed (duplicate)

Needs review isn't the right state for that, though.

I'll mark it duplicate since the feature is effectively in with hook_query alter.