Skip to:
Content

bbPress.org

Opened 12 years ago

Closed 12 years ago

Last modified 14 months ago

#1938 closed defect (bug) (fixed)

new "Fore index" sql clause conflicting with bbp_has_replies args !

Reported by: villagora's profile villagora Owned by:
Milestone: 2.1.3 Priority: highest omg sweet tea
Severity: blocker Version: 2.1
Component: Component - Replies Keywords:
Cc: contact@…

Description

Hi,

There is a mistake in _bbp_has_replies_where function. You can't change the where clause for add le "force index" like that.
Indeed, if like me, i want to pass args to bbp_has_replie function for make a meta query, a inner join is added to the query before the where clause (and so before the "force index" clause).

And in this case the sql query crash :

SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) FORCE INDEX (PRIMARY, post_parent) WHERE 1=1 AND (wp_posts.ID = 125 OR wp_posts.post_parent = 125) AND wp_posts.post_type IN ('topic', 'reply') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'closed') AND (wp_postmeta.meta_key = 'ratings_score' ) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value DESC LIMIT 0, 15

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORCE INDEX (PRIMARY, post_parent) WHERE 1=1 AND (wp_posts.ID = 125 OR wp_posts.' at line 1

I need a fix, thank you in advance !

Change History (5)

#1 @johnjamesjacoby
12 years ago

  • Milestone changed from Awaiting Review to 2.1.3

Duh. Confirmed, and this is pretty lame. Moving to 2.1.x milestone.

#2 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4162]) Replies:

  • Do not force single topic query to use specific indexes if also doing a meta query.
  • Fixes #1938 for 2.2 branch.

#3 @johnjamesjacoby
12 years ago

(In [4163]) Replies:

  • Do not force single topic query to use specific indexes if also doing a meta query.
  • Fixes #1938 for 2.1 branch.

#4 @villagora
12 years ago

Thank you JJJ ! :)
But, how can you fix it so that the topic should be displayed at the top of the same replies loop ?

#5 @tamarazuk
12 years ago

@villagora -- Were you able to fix this? If so, how?

I posted a topic on the bbPress Support Forums over 24 hours ago and have not received any help from users yet. (http://bbpress.org/forums/topic/topic-and-reply-content-not-displaying/)
I am unable to view any topic or reply content on the front end and would love to know how to fix this before I start exploring other forum options.

Note: See TracTickets for help on using tickets.