Sorry I forgot to say I am using WordPress 3.8 and Buddypress 1.8.1.
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.
Would it be possible to filter bp_members_pagination_links
depending on whether the plugin filters are set or not?
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?! 😉
Hi Bis,
Let me study your use case, I’ll get back to you soon.
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.
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?
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).
Does the pagination work if you revert to the default BuddyPress theme?
With the default Buddypress theme none of the content is visible – I am using a child theme of the “Responsive” theme.
And does the pagination work if you use the unmodified “Responsive” theme?
Again none of the content is visible – I guess the child theme I am using must be very customised?
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?
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?
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.