I have created a field that contains checkboxes (for simplicity, let's say the field name is FAVORITE-FRUIT and the checkbox options are apple, orange and mango).
Using PHP, I present a page that lists all of the members and their individual preference choices for FAVORITE-FRUIT. Retrieving the information for a specific user was easy enough.
- Code: Select all
$user = get_userdata($user_id);
$custom_fields = get_user_option('s2member_custom_fields', $user_id);
$fruitArray = (array) $custom_fields['favorite-fruit']
$fruitList = implode(',', $fruitArray)
Now, at the top of the page (above the list), I want to add a filter capability by presenting all of the checkbox options for FAVORITE-FRUIT so that someone can select a specific fruit THEN, after pressing a SUBMIT/FILTER button, see in the list only those users who have selected that same fruit.
I can't figure out how to retrieve the complete list of fruit options independent of a specific user who has selected all of them. Any suggestions?