Try using the bp_pre_user_query_construct hook
codex example
I have now added my own to functions.php which shows the correct counts but the links still don’t work and I have no idea why. When you click on them it always come up with page 1
function members_pagination_count() {
echo get_members_pagination_count();
}
function get_members_pagination_count() {
global $members_template;
global $count_of_excluded_members;
if ( empty( $members_template->type ) )
$members_template->type = '';
$page_arg = "upage";
$page_number = 1;
$per_page = 20;
$pag_page = !empty( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : (int) $page_number;
$pag_num = !empty( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : (int) $per_page;
$start_num = intval( ( $pag_page - 1 ) * $pag_num ) + 1;
$from_num = bp_core_number_format( $start_num );
$to_num = bp_core_number_format( ( $start_num + ( $pag_num - 1 ) > ($members_template->total_member_count - $count_of_excluded_members) ) ? ($members_template->total_member_count - $count_of_excluded_members) : $start_num + ( $pag_num - 1 ) );
$total = bp_core_number_format( $members_template->total_member_count - $count_of_excluded_members );
if ( 'active' == $members_template->type )
$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s active member)', 'Viewing member %1$s to %2$s (of %3$s active members)', $total, 'buddypress' ), $from_num, $to_num, $total );
else if ( 'popular' == $members_template->type )
$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member with friends)', 'Viewing member %1$s to %2$s (of %3$s members with friends)', $total, 'buddypress' ), $from_num, $to_num, $total );
else if ( 'online' == $members_template->type )
$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member online)', 'Viewing member %1$s to %2$s (of %3$s members online)', $total, 'buddypress' ), $from_num, $to_num, $total );
else
$pag = sprintf( _n( 'Viewing member %1$s to %2$s (of %3$s member)', 'Viewing member %1$s to %2$s (of %3$s members)', $total, 'buddypress' ), $from_num, $to_num, $total );
return apply_filters( 'members_pagination_count', $pag );
}
function members_pagination_links() {
echo get_members_pagination_links();
}
function get_members_pagination_links() {
global $members_template;
$page_arg = "upage";
$page_number = 1;
$per_page = 20;
$pag_page = !empty( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : (int) $page_number;
$pag_num = !empty( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : (int) $per_page;
$pag_links = paginate_links( array(
'base' => add_query_arg( $page_arg, '%#%' ),
'format' => '',
'total' => ceil( ((int) $members_template->total_member_count - (int)$count_of_excluded_members) / (int) $pag_num ),
'current' => (int) $pag_page,
'prev_text' => _x( '←', 'Member pagination previous text', 'buddypress' ),
'next_text' => _x( '→', 'Member pagination next text', 'buddypress' ),
'mid_size' => 1
) );
return apply_filters( 'get_members_pagination_links', $pag_links );
}
This is the page
http://www.ibsregister.com/members/
They look OK and I haven’t seen any JavaScript errors
OOps it is now working. I had missed out $args = wp_parse_args($qs); when doing the exclude for the subscriber role