bb_global_search_default_items_to_search( mixed $value )
Get the default items to search though, if nothing has been selected in settings.
Description
Parameters
- $value
-
(Required)
Return
(mixed)
Source
File: bp-search/bp-search-filters.php
function bb_global_search_default_items_to_search( $value ) { if ( empty( $value ) ) { /** * Setting > what to search? * If admin has not selected anything yet( right after activating the plugin maybe), * lets make sure search results do return someting at least. * So, by default, we'll search though blog posts and members. */ $value = array( 'posts', 'pages', 'members' ); } /* * If member search is turned on, but none of wp_user table fields or xprofile fields are selected, * we'll force username and nicename fields */ if ( in_array( 'members', $value ) ) { // Is any wp_user table colum or xprofile field selected? $field_selected = false; foreach ( $value as $item_to_search ) { if ( strpos( $item_to_search, 'member_field_' ) === 0 || strpos( $item_to_search, 'xprofile_field_' ) === 0 ) { $field_selected = true; break; } } //if not, lets add username and nicename to default items to search if ( ! $field_selected ) { $value[] = 'member_field_user_login'; $value[] = 'member_field_user_nicename'; } } return $value; }
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.