On a multi-language side I get for 'admin/content/comment/moderation' these errors and the displayed queue is empty:

user warning: Unknown column 'n.language' in 'where clause' query: SELECT COUNT(*) FROM comments c LEFT JOIN moderation_moderation mm ON c.cid = mm.obj_id LEFT JOIN node i18n ON n.tnid > 0 AND n.tnid = i18n.tnid AND i18n.language = 'en' WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL OR n.language = 'de' AND i18n.nid IS NULL) AND ( mm.obj_type = 'comment' AND (mm.status IS NULL OR mm.status=0) ) in /home/lilly-mi/public_html/sites/all/modules/moderation/moderation.moderation.inc on line 96.

user warning: Unknown column 'n.language' in 'where clause' query: SELECT c.*, mm.status as moderate FROM comments c LEFT JOIN moderation_moderation mm ON c.cid = mm.obj_id LEFT JOIN node i18n ON n.tnid > 0 AND n.tnid = i18n.tnid AND i18n.language = 'en' WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL OR n.language = 'de' AND i18n.nid IS NULL) AND ( mm.obj_type = 'comment' AND (mm.status IS NULL OR mm.status=0) )ORDER BY c.timestamp DESC, c.subject ASC LIMIT 0, 50 in /home/lilly-mi/public_html/sites/all/modules/moderation/moderation.moderation.inc on line 96.

What can I do?

CommentFileSizeAuthor
#6 moderation.moderation_new.patch593 bytesstevehuk

Comments

bjcool’s picture

Priority: Normal » Critical

Show stopper for I18N -> raise prio

bjcool’s picture

Status: Active » Fixed

Some i18n permissions were missing.

bjcool’s picture

Status: Fixed » Closed (fixed)

CLosing

neurovation.kiwi’s picture

Status: Closed (fixed) » Active

reopening that bug - cause the explanation dosn't fit my experience.

actually there might be a permission problem - but the bigger problem is, the db_rewrite_sql() !

in case of the comment, there are some params missing:
- primary table
- primary field

per default those are 'n' and 'nid' - but in case of the comments those should read 'c' and 'cid'!

please change the code in moderation.moderation.inc in function moderation_comment_queue() at line 97

from

  $result = pager_query(db_rewrite_sql($query), 50);

to

  $result = pager_query(db_rewrite_sql($query, 'c', 'cid'), 50);

cu
kiwi

neurovation.kiwi’s picture

well, just have to correct myself...

just found out that when using some node_access modules my presented solution is not really a solution.

so - best would be if you change the sql statement - not the rewrite statement:

  $query = "SELECT c.*, mm.status as moderate FROM {comments} c
           JOIN {node} n ON (c.nid = n.nid)
           LEFT JOIN {moderation_moderation} mm ON c.cid = mm.obj_id
           WHERE mm.obj_type = 'comment'
             AND (mm.status IS NULL OR mm.status=0)
           ORDER BY c.timestamp DESC, c.subject ASC";
  $result = pager_query(db_rewrite_sql($query), 50);

i included the corresponding node - in order for the node_access modules to kick in correctly!

cu
kiwi

stevehuk’s picture

StatusFileSize
new593 bytes

Just to note that this fix also worked when I got a similar message:

Unknown column 'n.nid' in 'on clause'

Changing the SQL as suggested in #5 did the job for me. In case it might be of use, a patch file is attached.

It would be good if this change could be checked and committed into the 1.* dev line, though I see that there is now a 2.x branch so if the new version is ready for use soon it may not be needed. A proper fix would be good - my users really like this modules approach to moderation.

neurovation.kiwi’s picture

Status: Active » Reviewed & tested by the community

if stevehuk's review is sufficient - please commit the change!

sanduhrs’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Assigned: Unassigned » sanduhrs
Status: Reviewed & tested by the community » Fixed

Commited to 6-DEV.
Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.