Skip to:
Content
Pages
Categories
Search
Top
Bottom

Combine bbpress and buddypress searches?


  • jreeve
    Participant

    @jreeve

    I have two search bars, one for buddypress (members, groups, blogs, posts), and one for bbpress (forums). It seems a little redundant to have two of these bars, and since the buddypress search bar has an option built-in to search forums on bbpress (like in the function bp_search_form_type_select), I thought it’d be neat to combine the two. Currently, my code looks like this:

    <h1><?php echo __( 'Search Members, Groups, and Blogs', 'buddypress' ); ?></h1>  
    <form action="<?php echo bp_search_form_action(); ?>" method="post" id="advanced-search-form"> 
    	<input type="text" id="search-terms" name="search-terms" value="<?php echo isset( $_REQUEST['s'] ) ? esc_attr( $_REQUEST['s'] ) : ''; ?>" placeholder="Search for:" />
    
    	<?php echo bp_search_form_type_select(); ?>
    
    	<input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ); ?>" />
    
    	<?php wp_nonce_field( 'bp_search_form' ); ?>
    
    </form><!-- #search-form -->
    
    <?php do_action( 'bp_search_login_bar' ); ?>
    
    <h1><?php echo __( 'Search Forums', 'buddypress' ); ?></h1>  <form role="search" method="get" id="bbp-search-form" action="<?php bbp_search_url(); ?>">
    	<div>
    		<input type="hidden" name="action" value="bbp-search-request" />
    		<input tabindex="<?php bbp_tab_index(); ?>" type="text" value="<?php echo esc_attr(            bbp_get_search_terms() ); ?>" name="bbp_search" id="bbp_search" placeholder="Search for:" />
    		<input tabindex="<?php bbp_tab_index(); ?>" class="button" type="submit"                       id="bbp_search_submit" value="<?php esc_attr_e( 'Search', 'bbpress' ); ?>" />
    	</div>
    </form>

    But it’d be much nicer to have one form instead of two. Is there a way to do that?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Combine bbpress and buddypress searches?’ is closed to new replies.
Skip to toolbar