`bp_get_member_profile_data` is only specific to one member. It will not grab all users with a certain xprofile field nor is there a built-in function that will do what you want.
I’d write a custom function to return the user IDs that match a certain field. Then use the `include` parameter in the members loop to do what you want to do.
eg. `if ( bp_has_members( ‘include=’ . my_custom_function() ) ) : `
`my_custom_function()` will have to be written!
If you know your way around WordPress, check out the `wp_bp_xprofile_data` table in your DB and a way to query the WPDB for hints. The `xprofile_get_field_id_from_name()` function will help as well.
@r-a-y
Hi,
this is the solution I found with your help, what you think?
`
bp_get_member_user_id(),’field’=>typology )); ?>
`
@beppe999 – That’s one way of doing it. It’s a quick way to achieve what you want, however you lose the ability to properly paginate and to grab a specific amount of members.
Hello,
I have a silly question for you. Where does this code go?
Does it go in a new members-loop.php file or a custom template?
Thanks for the pointers,
C.
Ok, nevermind. That was a very silly question
@r-a-y its true that pagination is all messed up. What is the better way of doing this?
I would guess this has to be done higher in the loop. I’m using this to get members displayed alphabetically and it works ok. Could this be used to select users based on custom profile field values as well?
`<?php
if ( bp_ajax_querystring( ‘members’ ) ==””)
{
$queryString = “type=alphabetical&action=alphabetical&per_page=150”;
}
else {
$queryString = bp_ajax_querystring( ‘members’ );
}
?>
`