Skip to:
Content

BuddyPress.org

Changeset 8525


Ignore:
Timestamp:
06/15/2014 06:12:02 PM (10 years ago)
Author:
boonebgorges
Message:

Don't use extract() in bp_activity_new_comment()

See #5698

File:
1 edited

Legend:

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

    r8522 r8525  
    12591259function bp_activity_new_comment( $args = '' ) {
    12601260
    1261     $params = wp_parse_args( $args, array(
     1261    $r = wp_parse_args( $args, array(
    12621262        'id'          => false,
    12631263        'content'     => false,
     
    12671267    ) );
    12681268
    1269     extract( $params, EXTR_SKIP );
    1270 
    12711269    // Bail if missing necessary data
    1272     if ( empty( $content ) || empty( $user_id ) || empty( $activity_id ) ) {
     1270    if ( empty( $r['content'] ) || empty( $r['user_id'] ) || empty( $r['activity_id'] ) ) {
    12731271        return false;
    12741272    }
    12751273
    12761274    // Maybe set current activity ID as the parent
    1277     if ( empty( $parent_id ) ) {
    1278         $parent_id = $activity_id;
    1279     }
     1275    if ( empty( $r['parent_id'] ) ) {
     1276        $r['parent_id'] = $r['activity_id'];
     1277    }
     1278
     1279    $activity_id = $r['activity_id'];
    12801280
    12811281    // Check to see if the parent activity is hidden, and if so, hide this comment publically.
     
    12851285    // Insert the activity comment
    12861286    $comment_id = bp_activity_add( array(
    1287         'id'                => $id,
    1288         'content'           => apply_filters( 'bp_activity_comment_content', $content ),
     1287        'id'                => $r['id'],
     1288        'content'           => apply_filters( 'bp_activity_comment_content', $r['content'] ),
    12891289        'component'         => buddypress()->activity->id,
    12901290        'type'              => 'activity_comment',
    1291         'user_id'           => $user_id,
     1291        'user_id'           => $r['user_id'],
    12921292        'item_id'           => $activity_id,
    1293         'secondary_item_id' => $parent_id,
     1293        'secondary_item_id' => $r['parent_id'],
    12941294        'hide_sitewide'     => $is_hidden
    12951295    ) );
     
    12991299
    13001300    // Walk the tree to clear caches for all parent items
    1301     $clear_id = $parent_id;
     1301    $clear_id = $r['parent_id'];
    13021302    while ( $clear_id != $activity_id ) {
    13031303        $clear_object = new BP_Activity_Activity( $clear_id );
     
    13071307    wp_cache_delete( $activity_id, 'bp_activity' );
    13081308
    1309     do_action( 'bp_activity_comment_posted', $comment_id, $params, $activity );
     1309    do_action( 'bp_activity_comment_posted', $comment_id, $r, $activity );
    13101310
    13111311    return $comment_id;
Note: See TracChangeset for help on using the changeset viewer.