Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5370 closed defect (bug) (fixed)

bp_legacy_theme_ajax_querystring per_page stopped working

Reported by: modemlooper's profile modemlooper Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.9.1
Component: Core Keywords:
Cc:

Description

Using the code below no longer works right. It only shows two items but when clicking pagination on activity it returns page 1 results and loads them below. On members loops It fades and then replaces itself with page 1 results.

Using per_page in a template file has same results. Changing per_page in bp-members-template.php > bp_has_members() works like it should.

function my_bp_loop_querystring( $query_string, $object ) {

    $query_string = 'per_page=2';

    return $query_string;
}
add_filter( 'bp_legacy_theme_ajax_querystring', 'my_bp_loop_querystring', 20, 2 );

Change History (5)

#1 @boonebgorges
11 years ago

modemlooper - Can you give details about when this actually did work? I just tested on 1.7 and 1.8 and it doesn't seem to work there either.

I'll keep digging for root causes.

#2 @boonebgorges
11 years ago

  • Keywords reporter-feedback added; dev-feedback removed

OK, looks like your filter is not correctly written. You're wiping out the entire $query_string, which means that the pagination arguments on subsequent pages are getting wiped out too. You have to add your param, not overwrite the whole thing:

function my_bp_loop_querystring( $query_string, $object ) {
    if ( ! empty( $query_string ) ) {
        $query_string .= '&';
    }

    $query_string .= 'per_page=2';

    return $query_string; 
}
add_action( 'bp_legacy_theme_ajax_querystring', 'my_bp_loop_querystring', 20, 2 );

I know this isn't the most elegant thing in the world, but it's how the filter has always worked. (We should come up with something a little easier to deal with in the future.)

#3 @modemlooper
11 years ago

whoops,

I had used the example I had written in codex, which oddly worked at one point. Will update codex.

Version 0, edited 11 years ago by modemlooper (next)

#4 @modemlooper
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#5 @r-a-y
11 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.