Skip to:
Content

BuddyPress.org

Changeset 817


Ignore:
Timestamp:
12/30/2008 05:44:15 PM (13 years ago)
Author:
apeatling
Message:

Adding filters to the header search form.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-templatetags.php

    r743 r817  
    459459    global $bp;
    460460   
    461     echo site_url('search');
     461    return apply_filters( 'bp_search_form_action', site_url('search') );
    462462}
    463463
    464464function bp_search_form_type_select() {
    465465    // Eventually this won't be needed and a page will be built to integrate all search results.
    466 ?>
    467     <select name="search-which" id="search-which" style="width: auto">
     466    $selection_box = '<select name="search-which" id="search-which" style="width: auto">';
     467   
     468    if ( function_exists( 'xprofile_install' ) ) {
     469        $selection_box .= '<option value="members">' . __( 'Members', 'buddypress' ) . '</option>';
     470    }
     471   
     472    if ( function_exists( 'groups_install' ) ) {
     473        $selection_box .= '<option value="groups">' . __( 'Groups', 'buddypress' ) . '</option>';
     474    }
     475   
     476    if ( function_exists( 'bp_blogs_install' ) ) {
     477        $selection_box .= '<option value="blogs">' . __( 'Blogs', 'buddypress' ) . '</option>';
     478    }
     479           
     480    $selection_box .= '</select>';
     481   
     482    return apply_filters( 'bp_search_form_type_select', $selection_box );
     483}
     484
     485function bp_search_form() {
     486    $form = '
     487        <form action="' . bp_search_form_action() . '" method="post" id="search-form">
     488            <input type="text" id="search-terms" name="search-terms" value="" />
     489            ' . bp_search_form_type_select() . '
    468490       
    469         <?php if ( function_exists( 'xprofile_install' ) ) { ?>
    470         <option value="members"><?php _e( 'Members', 'buddypress' ) ?></option>
    471         <?php } ?>
    472        
    473         <?php if ( function_exists( 'groups_install' ) ) { ?>
    474         <option value="groups"><?php _e( 'Groups', 'buddypress' ) ?></option>
    475         <?php } ?>
    476        
    477         <?php if ( function_exists( 'bp_blogs_install' ) ) { ?>
    478         <option value="blogs"><?php _e( 'Blogs', 'buddypress' ) ?></option>
    479         <?php } ?>
    480        
    481         <?php do_action( 'bp_search_form_type_select_options') ?>
    482     </select>
    483 <?php
     491            <input type="submit" name="search-submit" id="search-submit" value="' . __( 'Search', 'buddypress' ) . '" />
     492        </form>
     493    ';
     494   
     495    echo apply_filters( 'bp_search_form', $form );
    484496}
    485497
  • trunk/buddypress-theme/buddypress-home/header.php

    r720 r817  
    3131   
    3232    <div id="search-login-bar">
    33         <form action="<?php bp_search_form_action() ?>" method="post" id="search-form">
    34             <input type="text" id="search-terms" name="search-terms" value="" />
    35             <?php bp_search_form_type_select() ?>
    36 
    37             <input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    38         </form>
     33        <?php bp_search_form() ?>
    3934       
    4035        <?php if ( !is_user_logged_in() ) : ?>
  • trunk/buddypress-theme/member-themes/buddypress-member/header.php

    r729 r817  
    2828
    2929<div id="search-login-bar">
    30     <form action="<?php bp_search_form_action() ?>" method="post" id="search-form">
    31         <input type="text" id="search-terms" name="search-terms" value="" />
    32         <?php bp_search_form_type_select() ?>
    33        
    34         <input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    35     </form>
     30    <?php bp_search_form() ?>
    3631
    3732    <?php if ( !is_user_logged_in() ) : ?>
Note: See TracChangeset for help on using the changeset viewer.