BP Profile Search › Drop down field to multi select
-
AuthorPost
-
Muhammad RahmanGuest
Hi Andrea,
First and foremost, this is an amazing piece of work. So cleverly done. I am impressed. Thank you.
Secondly, I have a member city/country etc as drop down list. But when I search I want user to select multiple cities/countries. How can I achieve that please. I was hoping the ‘range’ option intelligently make that happen but it seems its only for number now.
Thank you in advance for your valuable time.
Muhammad.
Muhammad RahmanGuestI have managed to sort it out. Anyone interested, drop me a line to mmrs151@gmail.com
Thanks.
Muhammad RahmanGuesthmm, but I have a concern though.
I can move the legacy template to members directory as I have customisation to support my case but I also have customisation in
bps-teamplates47:if ($meta['field_mode'][$k] == 'range') { $f->display = 'range'; $f->type = bps_displayXsearch_form ($f); } elseif ($meta['field_mode'][$k] == 'multiselect') { $f->display = 'multiselect'; $f->type = bps_displayXsearch_form ($f); }
bps-xprofile
'selectbox' => array ('' => 'normal', 'range' => 'range', 'multiselect' => 'multiselect'),
if ($f->filter == 'range') { if ($type == 'datebox') { return 'age_range'; } elseif ($type == 'selectbox') { return 'multiselectbox'; } else { return 'range'; } }
etc …
which means plugin updates will break them.What would you suggest please.
Thanks in advance
Muhammad RahmanGuestelseif ($type == 'selectbox') { return 'multiselectbox'; }
sorry that was a debug code. It looks like this though,
if ($f->filter == 'multiselect') { if ($type == 'selectbox') { return 'multiselectbox'; } }
andreaPlugin AuthorHi Muhammad,
Sorry for the late reply!
If you wish to change the default display of a search field, you can add this code to your file bp-custom.php:
add_action ('bps_field_before_search_form', 'change_display'); function change_display ($field) { if ($field->id == 123) $field->display = 'multiselectbox'; }
Replace 123 with your actual field ID.
NewbieGuestHi, thanks for plugin, is great! 🙂
Could you apply this code for change display to textbox too?
thanks
andreaPlugin AuthorYes, you can change the display to textbox too:
add_action ('bps_field_before_search_form', 'change_display'); function change_display ($field) { if ($field->id == 123) $field->display = 'textbox'; }
-
AuthorPost