Opened 12 years ago
Last modified 13 months ago
#1962 new defect (bug)
BBpress does not get the right reply url if you change replies loop args.
Reported by: | villagora | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | omg sweet tea |
Severity: | major | Version: | 2.1.2 |
Component: | Tools - Code Improvements | Keywords: | needs-patch |
Cc: | contact@… |
Description
Hi,
I've modify the replies loop args for display last reply first ('orderby' => 'date', 'order' => 'DSC'); But if I post a new reply, BBpress redirect to the reply URL get by bbp_get_reply_url() function without paying attention to the order defined in the loop. So BBpress get the wrong page for my new reply (the last, instead of the first) and I'm redirect to the last page without my new reply.
That's a huge problem because, some one can reorder the replies by another value, by a metavalue for exemple. so the page returned must be calculated according to the display loop used.
NB : There are perhaps the same mistake for topics.
I hope you can implement that quickly. Thanks in avance...
Change History (7)
#1
in reply to:
↑ description
;
follow-up:
↓ 2
@
12 years ago
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
12 years ago
Replying to alexvorn2:
do you mean using query_posts() ?
No, I pass args directly to bbp_has_replies function in my custom bbpress theme compat ! ;)
But it's the same thing if you hook bbp_has_replies filter for make your own query...
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
12 years ago
Replying to villagora:
Replying to alexvorn2:
do you mean using query_posts() ?
No, I pass args directly to bbp_has_replies function in my custom bbpress theme compat ! ;)
But it's the same thing if you hook bbp_has_replies filter for make your own query...
I see... Do you have an idea how to fix it?
#4
in reply to:
↑ 3
@
12 years ago
This quick and dirty solution seems to make the trick (copy/paste line 355 in bbp-reply-template.php):
I need to replace bbp_get_reply_position by another function like bbp_get_loop_reply_position. for this stuff, indeed, I can use query_posts() and count manually the new reply position ($reply_id here) :
//get the user query global $query_string; // The Query query_posts( $query_string ); $position = 1; // The Loop while ( have_posts() ) : the_post(); if (get_the_ID()==$reply_id) break; else $position++; endwhile; // Reset Query wp_reset_query(); $reply_page = ceil( (int) $position / (int) bbp_get_replies_per_page() );
That works, but I don't know how we could do without this extra loop ..?
#5
@
12 years ago
- Milestone changed from Awaiting Review to Future Release
- Priority changed from high to normal
The solution above is pretty bad. Even so, this needs to get bumped to future release.
For now, the return values of bbp_get_reply_url() and bbp_get_reply_position() can be filtered if you need to customize them.
#6
@
9 years ago
- Keywords needs-patch added
Hi,
I have the same problem here with the bbp_topic_freshness_link()
function (loop-single-topic.php), is there any solution since the first ticket ?
Thanks,
Marie.
#7
@
4 years ago
- Priority changed from normal to omg sweet tea
I fixed this issue for my website in bbpress/includes/replies/template.php on line 470:
Change this line:
$reply_page = ceil( (int) bbp_get_reply_position( $reply_id, $topic_id ) / (int) bbp_get_replies_per_page() );
Into this:
$reply_page = ceil( (int) bbp_get_reply_position_raw( $reply_id, $topic_id ) / (int) bbp_get_replies_per_page() );
Problem solved! The topic and forum freshness permalinks work now as they should with the right pagination. Hope the bbpress team will apply this patch so we don't have to hack the core plugin file like this.
Cheers!
do you mean using query_posts() ?