Anybody have any idea about these questions?
With regard to the point in the final paragraph – when you sort the members list alphabetically, and then use the search facility, the SQL query looks like:
SELECT COUNT(DISTINCT u.ID) FROM wp_users u LEFT JOIN wp_usermeta um ON um.user_id = u.ID LEFT JOIN wp_bp_xprofile_data pd ON u.ID = pd.user_id WHERE u.user_status = 0 AND (pd.field_id = 1) AND pd.value LIKE ‘%%searchterm%%’ ORDER BY pd.value ASC;
It assumes pd.field_id = 1, which is the Name field – why does it assume you only care about searching on the Name field when ordering alphabetically? And how would I best modify this to search on a) the text values of all my text profile fields, and b) the labels on multiple option profile fields?
I am also trying to set the default of my members list to alphabetically instead of last active. I cannot find anywhere to show this. Can anyone help?
what params can be passed to the members loop (edit a theme file or create a child theme for members/index)
https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/
but a small bug, if no xprofile data then not all the members will be returned
https://trac.buddypress.org/ticket/1670
There must be a way to make the drop down default to alphabetically rather than activity.
Sorry to bring up a old post here, but…
I’m inside of the members-loop.php, I see there is a bp_ajax_querystring(‘members’).
How would I pass bp_has_members() a few parameters in combination with the above?
“
Something like this:
` ‘newest’, ‘per_page’=> 15 ) ?>`
I’d like to make the default filter ‘newest’ and have 15 members on a page.
Thanks!
Mic
This kinda worked, but then I lost the ability to filter by alphabetical, last active etc.
But if your looking to NOT filter it might be a solution.
`
<?php /* My Custom Member Query */
function my_query_filter_new ( $query_string ) {
$query_string .= ‘&per_page=15&type=newest’;
return $query_string;
}
add_filter( ‘bp_ajax_querystring’, ‘my_query_filter_new’ );
?>
`
In the Template-File members-loop-php I inserted the following Code at the top of the file:
`
<?php
if ( bp_ajax_querystring( ‘members’ ) ==””)
{
$queryString = “type=alphabetical&action=alphabetical&page=1”;
}
else {
$queryString = bp_ajax_querystring( ‘members’ );
}
?>
…`