Skip to:
Content

BuddyPress.org

Ticket #1915: 1915.patch

File 1915.patch, 9.6 KB (added by boonebgorges, 16 years ago)
  • bp-themes/bp-default/_inc/ajax.php

     
    5353        if ( !empty( $_POST['page'] ) && '-1' != $_POST['page'] )
    5454                $qs[] = 'page=' . $_POST['page'];
    5555
    56         if ( !empty( $_POST['search_terms'] ) && __( 'Search anything...', 'buddypress' ) != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] )
     56    $object_search_text = bp_get_search_default_text( $object );
     57        if ( !empty( $_POST['search_terms'] ) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] )
    5758                $qs[] = 'search_terms=' . $_POST['search_terms'];
    5859
    5960        /* Now pass the querystring to override default values. */
  • bp-core/bp-core-templatetags.php

     
    450450function bp_directory_members_search_form() {
    451451        global $bp;
    452452
    453         $search_value = __( 'Search anything...', 'buddypress' );
    454         if ( !empty( $_GET['s'] ) )
    455                 $search_value = $_GET['s'];
    456 
     453        $default_search_value = bp_get_search_default_text();
     454       
     455        $search_value = !empty( $_REQUEST['s'] ) ? $_REQUEST['s'] : $default_search_value;
     456       
    457457        ?>
    458458        <form action="" method="get" id="search-members-form">
    459                 <label><input type="text" name="s" id="members_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
     459                <label><input type="text" name="s" id="members_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label>
    460460                <input type="submit" id="members_search_submit" name="members_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    461461        </form>
    462462<?php
     
    10401040        return apply_filters( 'bp_search_form_type_select', $selection_box );
    10411041}
    10421042
     1043/**
     1044 * Get the default text for the search box for a given component.
     1045 *
     1046 * @global object $bp BuddyPress global settings
     1047 * @return string
     1048 * @since 1.3
     1049 */
     1050function bp_search_default_text() {
     1051    echo bp_get_search_default_text();
     1052}
     1053    function bp_get_search_default_text( $component = false ) {
     1054        global $bp;
     1055       
     1056        if ( empty( $component ) )
     1057            $component = $bp->current_component;
     1058       
     1059        return apply_filters( 'bp_search_default_text', $bp->default_search_strings[$component], $component );
     1060    }
     1061
    10431062function bp_search_form() {
    10441063        $form = '
    10451064                <form action="' . bp_search_form_action() . '" method="post" id="search-form">
  • bp-core/bp-core-classes.php

     
    166166                        }
    167167                }
    168168
    169                 if ( $search_terms && function_exists( 'xprofile_install' ) ) {
     169                if ( $search_terms && bp_is_active( 'xprofile' ) ) {
    170170                        $search_terms = like_escape( $wpdb->escape( $search_terms ) );
    171171                        $sql['where_searchterms'] = "AND pd.value LIKE '%%$search_terms%%'";
    172172                }
  • bp-blogs.php

     
    2525        /* Register this in the active components array */
    2626        $bp->active_components[$bp->blogs->slug] = $bp->blogs->id;
    2727
     28        $bp->default_search_strings['blogs'] = __( 'Search Blogs...', 'buddypress' );
     29
    2830        do_action( 'bp_blogs_setup_globals' );
    2931}
    3032add_action( 'bp_setup_globals', 'bp_blogs_setup_globals' );
  • bp-forums.php

     
    2727
    2828        /* Register this in the active components array */
    2929        $bp->active_components[$bp->forums->slug] = $bp->forums->id;
     30       
     31      $bp->default_search_strings['forums'] = __( 'Search Forum Topics...', 'buddypress' );
    3032
    3133        do_action( 'bp_forums_setup' );
    3234}
  • bp-groups.php

     
    4040        // Auto join group when non group member performs group activity
    4141        $bp->groups->auto_join = defined( 'BP_DISABLE_AUTO_GROUP_JOIN' ) ? false : true;
    4242
     43       $bp->default_search_strings['groups'] = __( 'Search Groups...', 'buddypress' );
     44
    4345        do_action( 'groups_setup_globals' );
    4446}
    4547add_action( 'bp_setup_globals', 'groups_setup_globals' );
  • bp-blogs/bp-blogs-templatetags.php

     
    496496}
    497497
    498498function bp_directory_blogs_search_form() {
    499         global $bp; ?>
     499        global $bp;
     500       
     501        $default_search_value = bp_get_search_default_text();
     502       
     503        $search_value = !empty( $_REQUEST['s'] ) ? $_REQUEST['s'] : $default_search_value;
     504       
     505        ?>
    500506        <form action="" method="get" id="search-blogs-form">
    501                 <label><input type="text" name="s" id="blogs_search" value="<?php if ( isset( $_GET['s'] ) ) { echo $_GET['s']; } else { _e( 'Search anything...', 'buddypress' ); } ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
     507                <label><input type="text" name="s" id="blogs_search" value="<?php echo esc_attr( $search_value ) ?>" onfocus="if (this.value == $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label>
    502508                <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    503509        </form>
    504510<?php
  • bp-forums/bp-forums-templatetags.php

     
    10251025function bp_directory_forums_search_form() {
    10261026        global $bp;
    10271027
    1028         $search_value = __( 'Search anything...', 'buddypress' );
    1029         if ( !empty( $_REQUEST['fs'] ) )
    1030                 $search_value = $_REQUEST['fs'];
     1028        $default_search_value = bp_get_search_default_text();
     1029       
     1030        $search_value = !empty( $_REQUEST['fs'] ) ? $_REQUEST['fs'] : $default_search_value;
    10311031
    10321032?>
    10331033        <form action="" method="get" id="search-forums-form">
    1034                 <label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
     1034                <label><input type="text" name="s" id="forums_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label>
    10351035                <input type="submit" id="forums_search_submit" name="forums_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    10361036        </form>
    10371037<?php
  • bp-core.php

     
    8181        /* The names of the core WordPress pages used to display BuddyPress content */
    8282        $bp->pages = $bp_pages;
    8383
    84         /* Set up the members id and active components entry */
     84        // Set up the members id and active components entry
    8585        $bp->members->id = 'members';
    8686        $bp->members->slug = $bp->pages->members->slug;
    8787        $bp->active_components[$bp->members->slug] = $bp->members->id;
     88       
     89        // Set up the default search text for the members component
     90        $bp->default_search_strings['members'] = __( 'Search Members...', 'buddypress' );
    8891
    8992        /* The user ID of the user who is currently logged in. */
    9093        $bp->loggedin_user->id = $current_user->ID;
  • bp-groups/bp-groups-templatetags.php

     
    18101810function bp_directory_groups_search_form() {
    18111811        global $bp;
    18121812
    1813         $search_value = __( 'Search anything...', 'buddypress' );
    1814         if ( !empty( $_REQUEST['s'] ) )
    1815                 $search_value = $_REQUEST['s'];
     1813        $default_search_value = bp_get_search_default_text();
     1814       
     1815        $search_value = !empty( $_REQUEST['s'] ) ? $_REQUEST['s'] : $default_search_value;
    18161816
    18171817?>
    18181818        <form action="" method="get" id="search-groups-form">
    1819                 <label><input type="text" name="s" id="groups_search" value="<?php echo esc_attr($search_value) ?>"  onfocus="if (this.value == '<?php _e( 'Search anything...', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search anything...', 'buddypress' ) ?>';}" /></label>
     1819                <label><input type="text" name="s" id="groups_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label>
    18201820                <input type="submit" id="groups_search_submit" name="groups_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    18211821        </form>
    18221822<?php