The comment block is rewritten, so should the regular comment view itself. Tested with a module which uses this (karma).

CommentFileSizeAuthor
#2 comment.module_18.diff1.08 KBdrumm
comment.module_35.patch1.08 KBdrumm

Comments

killes@www.drop.org’s picture

Shouldn't that be db_rewrite_sql($query, 'c', 'cid')?

drumm’s picture

StatusFileSize
new1.08 KB

Yep, here is a revised patch.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Well, we promised nid, tid, vid, cid in the beginning of db_rewrite_sql so... yes, this is needed.

dries’s picture

Status: Reviewed & tested by the community » Needs work

IMO, this patch is a bit of a hack. It allows you to rewrite the query for the comment block, but not for any of the other comment module's queries. It gives the false impression that you can use it to control access to comments, while the best you can do with it is, is implement 'recent comment' block that hides some comments.

markus_petrux’s picture

I agree with drumm this is needed for contrib modules that manage information related to comments.

But I also agree with Dries, there are more queries that would need to be hook_db_rewrite_sql aware.

Can we compile the list of such queries? Then we can work out a patch.

Proposed list of function that maybe need to use db_rewrite_sql:
* comment_edit()
* comment_reply()
* comment_render()
* comment_admin_overview()
* _comment_load()
* comment_form_add_preview()

killes@www.drop.org’s picture

Category: task » bug

Reclassifying as a bug.

I am not sure this patch makes sense. Our access scheme is geared at nodes, not comments. That means anybody who can see a node should be able to see all publushed comments, too.

The comment block already has already a rewrite function.

So I tend to mark this "won't fix".

drumm’s picture

Version: x.y.z » 6.x-dev
Status: Needs work » Closed (duplicate)