bp_ps_print_filter( $f )
Output BuddyBoss profile search condition filters.
Description
Source
File: bp-core/profile-search/bps-templates47.php
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | function bp_ps_print_filter( $f ) { if ( ! empty ( $f ->options ) ) { $values = array (); foreach ( $f ->options as $key => $label ) { if ( in_array( $key , $f ->values ) ) { $values [] = $label ; } } } if ( isset( $f ->filter ) ) { switch ( $f ->filter ) { case 'range' : case 'date_range' : if ( ! isset ( $f ->value[ 'max' ] ) ) { return sprintf( esc_html__( 'min: %1$s' , 'buddyboss' ), $f ->value[ 'min' ] ); } if ( ! isset ( $f ->value[ 'min' ] ) ) { return sprintf( esc_html__( 'max: %1$s' , 'buddyboss' ), $f ->value[ 'max' ] ); } return sprintf( esc_html__( 'min: %1$s, max: %2$s' , 'buddyboss' ), $f ->value[ 'min' ], $f ->value[ 'max' ] ); case '' : if ( isset ( $values ) ) { return sprintf( esc_html__( 'is: %1$s' , 'buddyboss' ), $values [0] ); } return sprintf( esc_html__( 'is: %1$s' , 'buddyboss' ), $f ->value ); case 'contains' : return sprintf( esc_html__( 'contains: %1$s' , 'buddyboss' ), $f ->value ); case 'like' : return sprintf( esc_html__( 'is like: %1$s' , 'buddyboss' ), $f ->value ); case 'one_of' : if ( count ( $values ) == 1 ) { return sprintf( esc_html__( 'is: %1$s' , 'buddyboss' ), $values [0] ); } return sprintf( esc_html__( 'is one of: %1$s' , 'buddyboss' ), implode( ', ' , $values ) ); case 'match_any' : if ( count ( $values ) == 1 ) { return sprintf( esc_html__( 'match: %1$s' , 'buddyboss' ), $values [0] ); } return sprintf( esc_html__( 'match any: %1$s' , 'buddyboss' ), implode( ', ' , $values ) ); case 'match_all' : if ( count ( $values ) == 1 ) { return sprintf( esc_html__( 'match: %1$s' , 'buddyboss' ), $values [0] ); } return sprintf( esc_html__( 'match all: %1$s' , 'buddyboss' ), implode( ', ' , $values ) ); case 'distance' : if ( $f ->value[ 'units' ] == 'km' ) { return sprintf( esc_html__( 'is within: %1$s km of %2$s' , 'buddyboss' ), $f ->value[ 'distance' ], $f ->value[ 'location' ] ); } return sprintf( esc_html__( 'is within: %1$s miles of %2$s' , 'buddyboss' ), $f ->value[ 'distance' ], $f ->value[ 'location' ] ); default : return "BP Profile Search: undefined filter <em>$f->filter</em>" ; } } } |
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.