Hey Kieran, I looked in the forum and it appears that someone may have had a similar question to me. So, I wanted to check with you to make sure this wasn’t the same code you’ve already added to my site. If not, can you tell me if this code would create a conflict with what you’ve already added? Here it is-
add_filter (‘bp_ajax_querystring’, ‘modify_members_loop’, 20, 2);
function modify_members_loop ($qs=false, $object=false)
{
global $wpdb;
if ($object != ‘members’) return $qs;
// figure out if the logged-in user is male or female
$gender = xprofile_get_field_data (5, bp_loggedin_user_id ());
if ($gender == ‘Male’)
$query = “SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 5 AND value = ‘Female'”;
else
$query = “SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 5 AND value = ‘Male'”;
$custom_ids = $wpdb->get_col ($query);
$args = wp_parse_args ($qs);
$args[‘include’] = implode (‘,’, $custom_ids);
$qs = build_query ($args);
return $qs;
}