[wp-meta] [Making WordPress.org] #2532: Forums: "Most popular topics" view is broken
Making WordPress.org
noreply at wordpress.org
Sat Feb 25 10:26:08 UTC 2017
#2532: Forums: "Most popular topics" view is broken
----------------------------+------------------
Reporter: SergeyBiryukov | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: Support Forums | Resolution:
Keywords: |
----------------------------+------------------
Comment (by SergeyBiryukov):
Replying to [comment:2 ocean90]:
> Can you provide the SQL query which bbPress would perform?
Currently:
{{{
SELECT SQL_CALC_FOUND_ROWS support_posts.ID FROM support_posts INNER JOIN
support_postmeta ON ( support_posts.ID = support_postmeta.post_id ) WHERE
1=1 AND support_posts.post_parent NOT IN (21261,21262,21272) AND (
support_postmeta.meta_key = '_bbp_reply_count'
) AND support_posts.post_type = 'topic' AND (support_posts.post_status =
'publish' OR support_posts.post_status = 'closed' OR
support_posts.post_status = 'private' OR support_posts.post_status =
'hidden') AND ( support_posts.ID >= 1 ) GROUP BY support_posts.ID ORDER BY
support_posts.ID DESC LIMIT 0, 15
}}}
With those lines removed:
{{{
SELECT SQL_CALC_FOUND_ROWS support_posts.ID FROM support_posts INNER JOIN
support_postmeta ON ( support_posts.ID = support_postmeta.post_id ) WHERE
1=1 AND support_posts.post_parent NOT IN (21261,21262,21272) AND (
support_postmeta.meta_key = '_bbp_reply_count'
) AND support_posts.post_type = 'topic' AND (support_posts.post_status =
'publish' OR support_posts.post_status = 'closed' OR
support_posts.post_status = 'private' OR support_posts.post_status =
'hidden') GROUP BY support_posts.ID ORDER BY support_postmeta.meta_value+0
DESC LIMIT 0, 15
}}}
The query is also performed twice, as `bbp_view_query()` is called twice
during the page load, I wonder if we could get rid of the second query
(haven't looked closely yet).
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2532#comment:3>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list