Hello Brian, Happy Holidays!
You can try this:
A) Open file wp-content\plugins\bp-profile-search\templates\members\bps-form-default.php
B) Locate the lines:
break;
case 'checkbox':
?>
C) Replace them with:
break;
case 'checkbox':
?>
<script>
jQuery(function ($) {
$('#<?php echo $id; ?>_all').on('click', function () {
$('#<?php echo $id; ?>_wrap input[type="checkbox"]').prop('checked', this.checked)
})
});
</script>
<label><input type="checkbox" id="<?php echo $id; ?>_all"> Select All</label><br>
D) Save the file, and copy it to the buddypress/members directory in your active theme’s root.
This works great! Thank you.
Another option I would like to implement is that dependent on the gender of the user doing the search, results would only be returned for the opposite gender. So if a a user has selected male in their profile when using the search form only users who are female will be returned as results using the other data on the form.
You can add this code to your bp-custom.php file:
add_filter ('bps_hidden_filters', 'my_hidden_filter');
function my_hidden_filter ($filters)
{
$user_id = bp_loggedin_user_id ();
if ($user_id != 0)
{
$gender = xprofile_get_field_data (247, $user_id);
if ($gender == 'Male')
$filters['field_247'] = 'Female';
else if ($gender == 'Female')
$filters['field_247'] = 'Male';
else
$filters['field_247'] = 'none';
}
return $filters;
}
Replace 247 with the actual field ID of your gender profile field, and Male and Female with its actual values.