Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Displaying the search term or phrase on member search

@henrywright-1

Member

OK i’ve come up with a solution but it feels dirty. Hoping someone can tell me if this approach is a bad one:

In header.php just above my search form I have


$standard_search_value = bp_get_search_default_text( 'members' );
$query_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $standard_search_value;

// globalise the search term or phrase variable so it can be used outside header.php
$GLOBALS['search_term_phrase'] = $query_value;

The in members-loop.php i can output the phrase when delivering results:

echo $GLOBALS['search_term_phrase'];

Skip to toolbar