bp_search_remove_search_types_for_guests( mixed $search_types )
Remove ‘messages’ and ‘notifications’ from search, if user is not logged In
Description
Parameters
- $search_types
-
(mixed) (Required)
Return
(mixed)
Source
File: bp-search/bp-search-filters.php
function bp_search_remove_search_types_for_guests( $search_types ) { if ( ! is_admin() && ! empty( $search_types ) && ! is_user_logged_in() ) { $items_to_remove = array( 'messages', 'notifications' ); $filtered_search_types = array(); foreach ( $search_types as $search_type ) { if ( ! in_array( $search_type, $items_to_remove ) ) { $filtered_search_types[] = $search_type; } } $search_types = $filtered_search_types; } return $search_types; }
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.