I am in the process of creating a user search form and would like to have the users have the ability to search for multiple check box conditions.
Here is what I currently have for the checkbox on the form
<input type="checkbox" class="textbox" name="services[]" id="services" value="ministryPlanning" /> Ministry Planning <br />
<input name="services[]" type="checkbox" id="services" value="visionAnalysis" /> Vision Analysis <br />
<input name="services[]" type="checkbox" id="services" value="buildingCommittee" /> Forming Planning/Building Committee <br />
<input name="services[]" type="checkbox" id="services" value="selectionConsultants" /> Selection of Other Consultants <br />
<input name="services[]" type="checkbox" id="services" value="educationProcess" /> Include Liturgical Education Process <br />
<input name="services[]" type="checkbox" id="services" value="largeGroup" /> Large Group Facilitation <br />
<input name="services[]" type="checkbox" id="services" value="smallGroup" /> Small Group Facilitation <br />
<input name="services[]" type="checkbox" id="services" value="spaceProgramming" /> Liturgical Space Programming <br />
<input name="services[]" type="checkbox" id="services" value="artConsulting" /> Liturgical Art Consulting <br />
<input name="services[]" type="checkbox" id="services" value="designsFunishing" /> Designs Liturgical Furnishings <br />
<input name="services[]" type="checkbox" id="services" value="furshinhingConsulting" /> Liturgical Furnishings Consulting <br />
<input name="services[]" type="checkbox" id="services" value="sacredArt" /> Designs/Fabricates/Installs Sacred Art or Furnishings <br />
<input name="services[]" type="checkbox" id="services" value="ritualPlanning" /> Ritual Planning <br />
<input name="services[]" type="checkbox" id="services" value="trainingMinisters" /> Training for Liturgical Ministers';
and here is the form processing
if(!empty($_GET['services'])) {
$arr = array('relation' => 'OR');
$i = 0;
foreach($_GET['services'] as $service) {
$arr[$i] = array(
'key' => 'services',
'value' => $service,
'compare' => 'LIKE'
);
$i = $i + 1;
}
$the_user_query = array('meta_query' => array($arr));
}
$the_users = new WP_User_Query( $the_user_query );
When I display the users that were selected it is always giving me back all of the users. But if I change the code to and hard code the selection it works.
$the_user_query = array(
'meta_query' => array(
'relation' => 'OR',
0 => array(
'key' => 'services',
'value' => 'ministryPlanning',
'compare' => 'LIKE'
),
1 => array(
'key' => 'services',
'value' => 'visionAnalysis',
'compare' => 'LIKE'
)
)
);
I am not sure what is different between the 2.
Here is the page for this site
http://liturgical-consultants.org/wp/find-a-member/