Skip to:
Content

BuddyPress.org

Changeset 4004


Ignore:
Timestamp:
02/02/2011 06:31:42 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Prevent debug notice in the event $component is unset in bp_get_search_default_text

File:
1 edited

Legend:

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

    r3989 r4004  
    349349
    350350                if ( empty( $component ) )
    351                         $component = $bp->current_component;
     351                        $component = bp_current_component();
    352352
    353353                $default_text = __( 'Search anything...', 'buddypress' );
    354354
    355355                // Most of the time, $component will be the actual component ID
    356                 if ( !empty( $bp->{$component}->search_string ) ) {
    357                         $default_text = $bp->{$component}->search_string;
    358                 } else {
    359                         // When the request comes through AJAX, we need to get the component
    360                         // name out of $bp->pages
    361                         if ( !empty( $bp->pages->{$component}->slug ) ) {
    362                                 $key = $bp->pages->{$component}->slug;
    363                                 if ( !empty( $bp->{$key}->search_string ) )
    364                                         $default_text = $bp->{$key}->search_string;
     356                if ( !empty( $component ) ) {
     357                        if ( !empty( $bp->{$component}->search_string ) ) {
     358                                $default_text = $bp->{$component}->search_string;
     359                        } else {
     360                                // When the request comes through AJAX, we need to get the component
     361                                // name out of $bp->pages
     362                                if ( !empty( $bp->pages->{$component}->slug ) ) {
     363                                        $key = $bp->pages->{$component}->slug;
     364                                        if ( !empty( $bp->{$key}->search_string ) )
     365                                                $default_text = $bp->{$key}->search_string;
     366                                }
    365367                        }
    366368                }
Note: See TracChangeset for help on using the changeset viewer.