Skip to:
Content

BuddyPress.org

Changeset 8520


Ignore:
Timestamp:
06/15/2014 01:01:44 PM (11 years ago)
Author:
boonebgorges
Message:

Don't use extract() in bp_activity_add()

See #5698

File:
1 edited

Legend:

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

    r8519 r8520  
    11321132        'is_spam'           => false, // Is this activity item to be marked as spam?
    11331133    );
    1134     $params = wp_parse_args( $args, $defaults );
    1135     extract( $params, EXTR_SKIP );
     1134    $r = wp_parse_args( $args, $defaults );
    11361135
    11371136    // Make sure we are backwards compatible
    1138     if ( empty( $component ) && !empty( $component_name ) )
    1139         $component = $component_name;
    1140 
    1141     if ( empty( $type ) && !empty( $component_action ) )
    1142         $type = $component_action;
     1137    if ( empty( $r['component'] ) && !empty( $r['component_name'] ) )
     1138        $r['component'] = $r['component_name'];
     1139
     1140    if ( empty( $r['type'] ) && !empty( $r['component_action'] ) )
     1141        $r['type'] = $r['component_action'];
    11431142
    11441143    // Setup activity to be added
    1145     $activity                    = new BP_Activity_Activity( $id );
    1146     $activity->user_id           = $user_id;
    1147     $activity->component         = $component;
    1148     $activity->type              = $type;
    1149     $activity->content           = $content;
    1150     $activity->primary_link      = $primary_link;
    1151     $activity->item_id           = $item_id;
    1152     $activity->secondary_item_id = $secondary_item_id;
    1153     $activity->date_recorded     = $recorded_time;
    1154     $activity->hide_sitewide     = $hide_sitewide;
    1155     $activity->is_spam           = $is_spam;
    1156     $activity->action            = ! empty( $action ) ? $action : bp_activity_generate_action_string( $activity );
     1144    $activity                    = new BP_Activity_Activity( $r['id'] );
     1145    $activity->user_id           = $r['user_id'];
     1146    $activity->component         = $r['component'];
     1147    $activity->type              = $r['type'];
     1148    $activity->content           = $r['content'];
     1149    $activity->primary_link      = $r['primary_link'];
     1150    $activity->item_id           = $r['item_id'];
     1151    $activity->secondary_item_id = $r['secondary_item_id'];
     1152    $activity->date_recorded     = $r['recorded_time'];
     1153    $activity->hide_sitewide     = $r['hide_sitewide'];
     1154    $activity->is_spam           = $r['is_spam'];
     1155    $activity->action            = ! empty( $r['action'] ) ? $r['action'] : bp_activity_generate_action_string( $activity );
    11571156
    11581157    if ( !$activity->save() )
     
    11641163
    11651164    wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
    1166     do_action( 'bp_activity_add', $params );
     1165    do_action( 'bp_activity_add', $r );
    11671166
    11681167    return $activity->id;
Note: See TracChangeset for help on using the changeset viewer.