forum posting of viewing posts yields "Column 'approved' in where clause is ambiguous" to non admins
- Status
- Closed
- Subject
- forum posting of viewing posts yields "Column 'approved' in where clause is ambiguous" to non admins
- Version
- 3.x
- Category
- Error
- Feature
- Forum
- Resolution status
- Fixed or Solved
- Submitted by
- Xavier de Pedro
- Lastmod by
- Xavier de Pedro
- Rating
- Description
This is a bit odd. Using trunk from today, Feb 10th, 2009, even if this bug was showing up with previous trunks, also.
I post a message as plain registered user, that I get this message just after posting:
Copy to clipboardError Error Ha hagut un error en una petició de la base de dades! Context: File tiki-view_forum_thread.php Url tiki-view_forum_thread.php?comments_parentId=3&forumId=1 Query: select tc1.`threadId`, tc1.`object`, tc1.`objectType`, tc1.`parentId`, tc1.`userName`, tc1.`commentDate`, tc1.`hits`, tc1.`type`, tc1.`points`, tc1.`votes`, tc1.`average`, tc1.`title`, tc1.`data`, tc1.`hash`, tc1.`user_ip`, tc1.`summary`, tc1.`smiley`, tc1.`message_id`, tc1.`in_reply_to`, tc1.`comment_rating` from `tiki_comments` as tc1 left outer join `tiki_comments` as tc2 on tc1.`in_reply_to` = tc2.`message_id` and tc1.`parentId` = ? and tc2.`parentId` = ? where tc1.`objectType` = ? and tc1.`object`=? and tc1.`parentId`=? and tc1.`average`>=? and `approved`=? and (tc1.`in_reply_to` = ? or (tc2.`in_reply_to` = "" or tc2.`in_reply_to` is null or tc2.message_id is null or tc2.parentid = 0)) order by tc1.`commentDate` asc,tc1.`threadId` Values: 0 3 1 3 2 forum 3 1 4 3 5 0 6 y 7 prova-0-21fe72956f@moviments.net Message: Column 'approved' in where clause is ambiguous Built query was probably: select tc1.`threadId`, tc1.`object`, tc1.`objectType`, tc1.`parentId`, tc1.`userName`, tc1.`commentDate`, tc1.`hits`, tc1.`type`, tc1.`points`, tc1.`votes`, tc1.`average`, tc1.`title`, tc1.`data`, tc1.`hash`, tc1.`user_ip`, tc1.`summary`, tc1.`smiley`, tc1.`message_id`, tc1.`in_reply_to`, tc1.`comment_rating` from `tiki_comments` as tc1 left outer join `tiki_comments` as tc2 on tc1.`in_reply_to` = tc2.`message_id` and tc1.`parentId` = '3' and tc2.`parentId` = '3' where tc1.`objectType` = 'forum' and tc1.`object`='1' and tc1.`parentId`='3' and tc1.`average`>='0' and `approved`='y' and (tc1.`in_reply_to` = 'prova-0-21fe72956f@moviments.net' or (tc2.`in_reply_to` = "" or tc2.`in_reply_to` is null or tc2.message_id is null or tc2.parentid = 0)) order by tc1.`commentDate` asc,tc1.`threadId`
As admin user, I can see that post, and any other.- Solution
Fixed by sylvie with:
Copy to clipboard--- lib/commentslib.php (revision 16643) +++ lib/commentslib.php (working copy) @@ -1615,13 +1615,13 @@ $bindvars = array_merge(array($object[0], $object[1], (float) $threshold), $bind_time); if ( $tiki_p_admin_comments != 'y' ) { - $queue_cond = 'and `approved`=?'; + $queue_cond = 'and tc1.`approved`=?'; $bindvars[] = $approved; } else { $queue_cond = ''; } - $query = "select count(*) from `tiki_comments` where + $query = "select count(*) from `tiki_comments` as tc1 where `objectType`=? and `object`=? and `average` < ? $time_cond $queue_cond"; $below = $this->getOne($query, $bindvars);- Importance
- 7
- Priority
- 35
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 2301
- Created
- Tuesday 10 February, 2009 12:15:32 UTC
by Unknown - LastModif
- Wednesday 11 February, 2009 09:20:56 UTC