Skip to:
Content

BuddyPress.org

Changeset 3341


Ignore:
Timestamp:
11/02/2010 09:50:58 PM (14 years ago)
Author:
djpaul
Message:

Add better filters to bp_search_form_type_select(). Fixes #2503.

File:
1 edited

Legend:

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

    r3339 r3341  
    10041004}
    10051005
     1006/**
     1007 * Generates the basic search form as used in BP-Default's header.
     1008 *
     1009 * @global object $bp BuddyPress global settings
     1010 * @return string HTML <select> element
     1011 * @since 1.0
     1012 */
    10061013function bp_search_form_type_select() {
    10071014    global $bp;
     1015
     1016    $options = array();
     1017   
     1018    if ( bp_is_active( 'xprofile' ) )
     1019        $options['members'] = __( 'Members', 'buddypress' );
     1020
     1021    if ( bp_is_active( 'groups' ) )
     1022        $options['groups'] = __( 'Groups', 'buddypress' );
     1023
     1024    if ( function_exists( 'bp_forums_is_installed_correctly' ) && bp_forums_is_installed_correctly() && !(int) $bp->site_options['bp-disable-forum-directory'] )
     1025        $options['forums'] = __( 'Forums', 'buddypress' );
     1026
     1027    if ( bp_is_active( 'blogs' ) && bp_core_is_multisite() )
     1028        $options['blogs'] = __( 'Blogs', 'buddypress' );
    10081029
    10091030    // Eventually this won't be needed and a page will be built to integrate all search results.
    10101031    $selection_box = '<select name="search-which" id="search-which" style="width: auto">';
    10111032
    1012     if ( bp_is_active( 'xprofile' ) ) {
    1013         $selection_box .= '<option value="members">' . __( 'Members', 'buddypress' ) . '</option>';
    1014     }
    1015 
    1016     if ( bp_is_active( 'groups' ) ) {
    1017         $selection_box .= '<option value="groups">' . __( 'Groups', 'buddypress' ) . '</option>';
    1018     }
    1019 
    1020     if ( function_exists( 'bp_forums_is_installed_correctly' ) && bp_forums_is_installed_correctly() && !(int) $bp->site_options['bp-disable-forum-directory'] ) {
    1021         $selection_box .= '<option value="forums">' . __( 'Forums', 'buddypress' ) . '</option>';
    1022     }
    1023 
    1024     if ( bp_is_active( 'blogs' ) && bp_core_is_multisite() ) {
    1025         $selection_box .= '<option value="blogs">' . __( 'Blogs', 'buddypress' ) . '</option>';
    1026     }
     1033    $options = apply_filters( 'bp_search_form_type_select_options', $options );
     1034    foreach( (array)$options as $option_value => $option_title )
     1035        $selection_box .= sprintf( '<option value="%s">%s</option>', $option_value, $option_title );
    10271036
    10281037    $selection_box .= '</select>';
Note: See TracChangeset for help on using the changeset viewer.