Here is what I have so far:
I have a drop down list of all user levels, when a user level is selected from the dropdown I would like to automatically set the $search to that value so when search is clicked. (Or better, an automatic javascript action.)
One main problem is that ‘s2member_access_label’ does not work when used in search_columns. So far I have been unable to search users by the s2member_access_label, which is essential.
Here’s the code:
//The search
echo do_shortcode("[s2Member-List-Search-Box
placeholder='Search Members by: Name, City, Country, Keyword'
template='themes/my-genesis-2.0/s2-templates/member-list-search-box.php
/]
");
//The dropdown select ?>
<label for="_member_level">Member Level:</label><br />
<select name="_member_level" id="_member_level" class="member-level-select" >
<?php
$lvl = array(
'2' => 'Level 2',
'3' => 'Level 3',
'4' => 'Level 4',
'5' => 'Level 5',
'6' => 'Level 6',
'7' => 'Level 7',
'8' => 'Level 8',
'9' => 'Level9',
'10' => 'Level 10',
'11' => 'Level 11',
);
$selected = esc_attr( $lvl );
foreach ($lvl as $code => $label) {
echo '<option value="'.$code.'"';
if ($selected == $code) {
echo ' selected="selected"';
}
echo '>' . $label . '</option>';
}
?>
</select>
<?php
$siteURL = get_bloginfo ( 'url' );
//set a default value to $search. I want to update this with the selected option from the form above.
$search="";
//Set up search_columns. We may dynamically alter this list.
//NOTE: s2member_access_label does not work.
$searchColumns = 'first_name, last_name, nickname,user_login,user_email,user_url,user_nicename,display_name, s2member_access_label,s2member_custom_field_city,s2member_custom_field_state,s2member_custom_field_country,s2member_custom_field_user_bio';
echo do_shortcode("
//The list shortcode. The display name links to the authors archive, which is used as a profile page.
//$search and $searchColumns allow us to dynamically change the search parameters
//The list template has been customized
[s2Member-List
link_display_name='$siteURL/author/%%username%%'
levels='3,4,5,6,7,8,9,10,11'
rlc_satisfy='ANY'
order='asc'
search='$search'
search_columns='$searchColumns'
orderby='last_name'
enable_list_search='yes'
template='themes/my-genesis-2.0/s2-templates/custom-member-list.php'
/] ");