#2532 closed defect (bug) (fixed)
Forums: "Most popular topics" view is broken
Reported by: | SergeyBiryukov | Owned by: | netweb |
---|---|---|---|
Milestone: | Q1 | Priority: | normal |
Component: | Support Forums | Keywords: | |
Cc: |
Description
https://wordpress.org/support/view/popular/ appears to be broken: it's supposed to display the list of the most commented topics, but at the moment it just displays the first page of the "All Topics" view.
Works as expected on https://ru.wordpress.org/support/view/popular/ though, so I guess it might be a result of performance optimizations specific to the English forums.
Change History (12)
#3
in reply to:
↑ 2
@
8 years ago
Replying to ocean90:
Can you provide the SQL query which bbPress would perform?
Currently:
SELECT SQL_CALC_FOUND_ROWS wporg_419_posts.ID FROM wporg_419_posts INNER JOIN wporg_419_postmeta ON ( wporg_419_posts.ID = wporg_419_postmeta.post_id ) WHERE 1=1 AND wporg_419_posts.post_parent NOT IN (21261,21262,21272) AND ( wporg_419_postmeta.meta_key = '_bbp_reply_count' ) AND wporg_419_posts.post_type = 'topic' AND (wporg_419_posts.post_status = 'publish' OR wporg_419_posts.post_status = 'closed' OR wporg_419_posts.post_status = 'private' OR wporg_419_posts.post_status = 'hidden') AND ( wporg_419_posts.ID >= 1 ) GROUP BY wporg_419_posts.ID ORDER BY wporg_419_posts.ID DESC LIMIT 0, 15
With those lines removed:
SELECT SQL_CALC_FOUND_ROWS wporg_419_posts.ID FROM wporg_419_posts INNER JOIN wporg_419_postmeta ON ( wporg_419_posts.ID = wporg_419_postmeta.post_id ) WHERE 1=1 AND wporg_419_posts.post_parent NOT IN (21261,21262,21272) AND ( wporg_419_postmeta.meta_key = '_bbp_reply_count' ) AND wporg_419_posts.post_type = 'topic' AND (wporg_419_posts.post_status = 'publish' OR wporg_419_posts.post_status = 'closed' OR wporg_419_posts.post_status = 'private' OR wporg_419_posts.post_status = 'hidden') GROUP BY wporg_419_posts.ID ORDER BY wporg_419_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).
Caused by these two lines, introduced in [3903].
$r['orderby'] = 'ID';
for "Most popular topics" view?The first item should make the view at least somewhat accurate.