default filter
-
Hello,
I’m trying to create a filter for a members directory. What I want:
– when loggedin users click the menu link to go to the membersdirectory, I want the directory to be prefiltered.
– the filter should be on field_241 (textfield)
– the value should be based on the user profile:
$value = xprofile_get_field_data (241, $user_id);
When a loggedin user visits the memberdirectory (and has ‘dance’ in userprofile field 241) I would like them to see members that have ‘dance’ in field 241 by default, but be able to search all other ‘values’.A hidden field doesn’t work for then they cannot search for other values in field 241.
– add_filter (‘bps_hidden_filters’, ‘my_hidden_filters’);
– function my_hidden_filters ($filters);Filtering search results seems to have the same problem
– add_filter (‘bps_search_results’, ‘my_filter_241’);
– function my_filter_241 ($users)A default value doesn’t filter the results when they visit.
– add_action (‘bps_field_before_search_form’, ‘set_default’);
– function set_default ($f) {
if ($f->code == ‘field_241’) {
…$f->value = xprofile_get_field_data(241, $user_id);…
}
}I’m hoping there is an obvious solution that I missed.
The page I need help with: [log in to see the link]
- The topic ‘default filter’ is closed to new replies.