Support » Plugin: BP Profile Search » Paginating queries

  • Resolved Biswadip

    (@biswadip)


    Great plugin but sorry the pagination is not working for me. The search results for the search fields all come up great but as soon as I put pagination in my buddypress members loop

    <?php if ( bp_has_members('per_page=5' ) ) : ?>

    the search parameter is lost after the first page of the results if the results extend beyond a page. The only way I can have all the results displayed is by having a suitably high number per page so they are all on the same page. Is this normal behaviour or am I missing something?

    Thanks

    Bis

    https://wordpress.org/plugins/bp-profile-search/

Viewing 15 replies - 1 through 15 (of 21 total)
  • Thread Starter Biswadip

    (@biswadip)

    Sorry I forgot to say I am using WordPress 3.8 and Buddypress 1.8.1.

    Thread Starter Biswadip

    (@biswadip)

    I found a thread here:

    which suggests that the query needs to be modified by the filter as an “include” something like this:

    if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&page_arg=bapage&per_page=10&include=' . /*filter parameter*/ ) ) : ?>

    but I am not sure what the “filter parameter” would be in this case.

    Thread Starter Biswadip

    (@biswadip)

    Would it be possible to filter bp_members_pagination_links depending on whether the plugin filters are set or not?

    Thread Starter Biswadip

    (@biswadip)

    I think what I need to do is something like:

    if ( bp_has_members( bp_ajax_querystring( 'members' ) . '&per_page=5&type=alphabetical&search_terms=' . /*variable with search terms from plugin filter/*) ) : ?>

    but no idea what “variable with search terms from plugin filter” should be?! 😉

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Bis,

    Let me study your use case, I’ll get back to you soon.

    Thread Starter Biswadip

    (@biswadip)

    Thank you Andrea!

    When I put a condition around the members loop, something like:

    <?php if (isset ($_REQUEST['bp_profile_search'])){
    echo $_REQUEST['bp_profile_search']) ?>

    it echoes “true” when the filters are set but I still don’t know what search term to include in the loop to get the pagination working.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hello Bis,

    I think your BuddyPress members loop should look like this:

    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ).'&per_page=5' ) ) : ?>

    Could you please test it?

    Thread Starter Biswadip

    (@biswadip)

    Thanks Andrea.

    Same story I am afraid – the results come up paginated but when I click the page links (so the url suffix changes to “?upage=2”)the search query is lost and page 2 of the unfiltered search comes up (also the “Clear” parameter of the query at the top of the first page disappears).

    Plugin Author Andrea Tarantini

    (@dontdream)

    Does the pagination work if you revert to the default BuddyPress theme?

    Thread Starter Biswadip

    (@biswadip)

    With the default Buddypress theme none of the content is visible – I am using a child theme of the “Responsive” theme.

    Plugin Author Andrea Tarantini

    (@dontdream)

    And does the pagination work if you use the unmodified “Responsive” theme?

    Thread Starter Biswadip

    (@biswadip)

    Again none of the content is visible – I guess the child theme I am using must be very customised?

    Thread Starter Biswadip

    (@biswadip)

    OK so I am guessing the reason the other themes don’t show the content is because the templates for the content are in the theme folder. Do you want me to copy the templates over to the folders for the other themes like the Responsive theme before activating them?

    Plugin Author Andrea Tarantini

    (@dontdream)

    No, I think we are only interested in the Members directory page.

    Does the pagination in the Members directory work if you use the unmodified child theme?

    Thread Starter Biswadip

    (@biswadip)

    Yes sorry you are right.

    The pagination for the filters of the plugin works perfectly in the members directory.

    But it does not work in my custom members page which is not in my members directory. It is a page for newly registered user who are given the option of searching for members and making friends but without the navigation links on the page in the members directory because we want the users to complete these steps before they start using the site. The pagination works for the members listing – each page link correctly brings up the different members – but the pagination does not work for the plugin filters – the correct number of page links is brought up for the filtered query and the first page displays the correct results but when you click, for example, the link for page 2 (so the url changes to the “?upage=2” suffix)page 2 displays the second page not of the filtered query but of the unfiltered members listing.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Paginating queries’ is closed to new replies.