-
-
Save imath/24fdfa1b8625477e93c0daa0d90b2a44 to your computer and use it in GitHub Desktop.
Fix bbPress pagination in BP Member's forum page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
/** | |
* bbPress should include such an action into its `src/includes/extend/buddypress/members.php` file. | |
*/ | |
function fix_bbpress_member_pagination( &$query ) { | |
if ( bp_is_user() && bp_is_current_component( 'forums' ) ) { | |
$action_variables = (array) bp_action_variables(); | |
if ( function_exists( 'bbp_get_paged_slug' ) && bbp_get_paged_slug() === bp_action_variable( 0 ) ) { | |
$query->set( 'paged', (int) bp_action_variable( 1 ) ); | |
} | |
} | |
} | |
add_action( 'bp_members_parse_query', 'fix_bbpress_member_pagination' ); |
Interesting, were you also using the paged query var ?
Yep! Something that used to work in the Docs plugin stopped working some time ago--I'm not really even sure when. Our fix was similar: Look specifically for the action args and set the page: boonebgorges/buddypress-docs@b1f39bb
This problem also exists on group pages so I had to adjust the code slightly for my own usecase. But everyone should be able to do this depending on their usecase.
FYI this will be fixed in BP Classic v1.4.0, see buddypress/bp-classic#44
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We found an issue like this is BP Docs, too, where the pagination of our custom component had stopped working, but I think it had stopped working by BP v11.