Skip to content

Instantly share code, notes, and snippets.

@imath
Created December 30, 2023 10:31
Show Gist options
  • Select an option

  • Save imath/24fdfa1b8625477e93c0daa0d90b2a44 to your computer and use it in GitHub Desktop.

Select an option

Save imath/24fdfa1b8625477e93c0daa0d90b2a44 to your computer and use it in GitHub Desktop.
Fix bbPress pagination in BP Member's forum page
<?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' );
@imath

imath commented Feb 13, 2024

Copy link
Copy Markdown
Author

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