Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/17/2012 02:01:16 PM (12 years ago)
Author:
boonebgorges
Message:

Refactors bp_has_activities() stack to support the passing of arguments as associative arrays.

  • Maintains backward compatibility by parsing old-style parameters using bp_core_parse_args_array(), converting to new-style array, and throwing _deprecated_argument() error
  • Changes calls to BP_Activity_Template::construct() and BP_Activity_Activity::get() to use the new format throughout BuddyPress
  • See #3797
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-functions.php

    r5938 r5993  
    821821    if ( 1 == (int) $page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && empty( $exclude ) && empty( $in ) && 'DESC' == $sort && empty( $exclude ) && 'ham_only' == $spam ) {
    822822        if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
    823             $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, false, false, $spam );
     823            $args = array(
     824                'page'             => $page,
     825                'per_page'         => $per_page,
     826                'max'              => $max,
     827                'sort'             => $sort,
     828                'search_terms'     => $search_terms,
     829                'filter'           => $filter,
     830                'display_comments' => $display_comments,
     831                'show_hidden'      => $show_hidden,
     832                'spam'             => $spam
     833            );
     834            $activity = BP_Activity_Activity::get( $args );
    824835            wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
    825836        }
    826837
    827838    } else {
    828         $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, $exclude, $in, $spam );
     839        $args = array(
     840            'page'             => $page,
     841            'per_page'         => $per_page,
     842            'max'              => $max,
     843            'sort'             => $sort,
     844            'search_terms'     => $search_terms,
     845            'filter'           => $filter,
     846            'display_comments' => $display_comments,
     847            'show_hidden'      => $show_hidden,
     848            'exclude'          => $exclude,
     849            'in'               => $in,
     850            'spam'             => $spam
     851        );
     852        $activity = BP_Activity_Activity::get( $args );
    829853    }
    830854
     
    859883    extract( $r, EXTR_SKIP );
    860884
    861     return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, $show_hidden, false, $activity_ids, $spam ) );
     885    $get_args = array(
     886        'page'             => $page,
     887        'per_page'         => $per_page,
     888        'max'              => $max,
     889        'sort'             => $sort,
     890        'display_comments' => $display_comments,
     891        'show_hidden'      => $show_hidden,
     892        'in'               => $activity_ids,
     893        'spam'             => $spam
     894    );
     895    return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $get_args ), $args, $get_args );
    862896}
    863897
Note: See TracChangeset for help on using the changeset viewer.