Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do i use bp_user_query search_terms on my theme?


  • coolhunt
    Participant

    @coolhunt

    Hey Guys,

    Im trying to put together a simple php snippet to insert in my existing theme so that it spits out a list of buddypress members.
    I often use mydomain.com/?s=search_term as a quick and easy way for my users to browse thru arbitrary post.
    I’d like to include a simple return of buddypress member names along with the search results.

    *any ideas would be helpful

    // The Query
    $user_query = new bp_user_query( $args );
    
    // User Loop
    if ( ! empty( $user_query->results ) ) {
    	foreach ( $user_query->results as $user ) {
    		echo '<p>' . $user->display_name . '</p>';
    	}
    } else {
    	echo 'No users found.';
    }
    ?>
Viewing 1 replies (of 1 total)

  • coolhunt
    Participant

    @coolhunt

    Ok. Im a dummy..

    I need to use bp_has_members

    bp_has_members("search_terms={return-users-with-term-from-get_search_query}")

    my goal is to have a code snippet that i can use inside my theme so that anytime theres a search – it also returns a list of bp members.

    any ideas? (p.s. i really have no clue what im doing)

    <p>members <?php echo bp_has_members("search_terms={return-users-with-term-from-get_search_query}"); ?>" . these are members </p>
    
    <p>normal post " <?php echo esc_html( get_search_query( false ) ); ?> ". Here are the results:</p>
    
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar