Skip to:
Content

BuddyPress.org

Changeset 8447


Ignore:
Timestamp:
05/24/2014 12:13:51 PM (10 years ago)
Author:
boonebgorges
Message:

Set default search terms before function params are parsed in bp_has_blogs()

By getting the default value of the search_terms parameter from $_REQUEST
before parameters are parsed, we ensure that 'search_terms' is passed to the
bp_parse_args() filter in the same way as the rest of the function params.

See #5456 and r8116 for a similar change in bp_has_groups()

See #5660

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-template.php

    r8408 r8447  
    341341 *     @type array $include_blog_ids Array of blog IDs to limit results to.
    342342 *     @type string $sort 'ASC' or 'DESC'. Default: 'DESC'.
    343  *     @type string $search_terms Limit results by a search term. Default: null.
     343 *     @type string $search_terms Limit results by a search term. Default: the
     344 *           value of $_REQUEST['s'], if present.
    344345 *     @type int $user_id The ID of the user whose blogs should be retrieved.
    345346 *           When viewing a user profile page, 'user_id' defaults to the ID of
     
    358359    $type         = 'active';
    359360    $user_id      = 0;
    360     $search_terms = null;
    361361
    362362    // User filtering
    363363    if ( bp_displayed_user_id() )
    364364        $user_id = bp_displayed_user_id();
     365
     366    if ( isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) ) {
     367        $search_terms = $_REQUEST['s'];
     368    } else {
     369        $search_terms = false;
     370    }
    365371
    366372    $defaults = array(
     
    380386    $r = bp_parse_args( $args, $defaults, 'has_blogs' );
    381387    extract( $r );
    382 
    383     if ( is_null( $search_terms ) ) {
    384         if ( isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) )
    385             $search_terms = $_REQUEST['s'];
    386         else
    387             $search_terms = false;
    388     }
    389388
    390389    if ( $max ) {
Note: See TracChangeset for help on using the changeset viewer.