bp_ps_save_hidden_filters( $attr, $content )
Saves BuddyBoss Profile Search hidden filters.
Description
Source
File: bp-core/profile-search/bps-search.php
function bp_ps_save_hidden_filters ($attr, $content) { global $bp_ps_hidden_filters; $bp_ps_hidden_filters = array ('bp_ps_directory' => bp_ps_current_page ()); list (, $fields) = bp_ps_get_fields (); $split = isset ($attr['split'])? $attr['split']: ','; if (is_array ($attr)) foreach ($attr as $key => $value) { $k = bp_ps_match_key ($key, $fields); if ($k === false) continue; $f = $fields[$k]; $filter = ($key == $f->code)? '': substr ($key, strlen ($f->code) + 1); if (!bp_ps_Fields::is_filter ($f, $filter)) continue; $selector = $filter. (count ($f->options)? '/e': ''); switch ($selector) { case 'contains': case '': case 'like': $value = trim (addslashes ($value)); if ($value !== '') $bp_ps_hidden_filters[$key] = $value; break; case 'range': case 'age_range': list ($min, $max) = explode ($split, $value); $values = array (); if (($min = trim ($min)) !== '') $values['min'] = $min; if (($max = trim ($max)) !== '') $values['max'] = $max; if (!empty ($values)) $bp_ps_hidden_filters[$key] = $values; break; case 'match_any/e': case 'match_all/e': case '/e': case 'one_of/e': $flipped = array_flip ($f->options); $values = explode ($split, $value); $keys = array (); foreach ($values as $value) { $value = trim ($value); if (isset ($flipped[$value])) $keys[] = addslashes ($flipped[$value]); } if (!empty ($keys)) $bp_ps_hidden_filters[$key] = $keys; break; } } add_filter ('body_class', function ($classes) {return array_merge (array ('directory', 'members', 'buddypress'), $classes);}); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.