Skip to:
Content

BuddyPress.org

Changeset 2381 for trunk/bp-friends.php


Ignore:
Timestamp:
01/20/2010 04:21:20 PM (16 years ago)
Author:
apeatling
Message:

Standardizing activity stream fields and splitting the action from the content for better manageability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends.php

    r2369 r2381  
    269269    $defaults = array(
    270270        'user_id' => $bp->loggedin_user->id,
    271         'content' => false,
    272         'primary_link' => false,
    273         'component_name' => $bp->friends->id,
    274         'component_action' => false,
     271        'action' => '',
     272        'content' => '',
     273        'primary_link' => '',
     274        'component' => $bp->friends->id,
     275        'type' => false,
    275276        'item_id' => false,
    276277        'secondary_item_id' => false,
     
    282283    extract( $r, EXTR_SKIP );
    283284
    284     return bp_activity_add( array( 'user_id' => $user_id, 'content' => $content, 'primary_link' => $primary_link, 'component_name' => $component_name, 'component_action' => $component_action, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
     285    return bp_activity_add( array( 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide ) );
    285286}
    286287
     
    288289    if ( function_exists('bp_activity_delete_by_item_id') ) {
    289290        extract( (array)$args );
    290         bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $bp->friends->id, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
     291        bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component' => $bp->friends->id, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) );
    291292    }
    292293}
     
    389390
    390391    // Remove the activity stream item for the user who canceled the friendship
    391     friends_delete_activity( array( 'item_id' => $friendship_id, 'component_action' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
     392    friends_delete_activity( array( 'item_id' => $friendship_id, 'type' => 'friendship_accepted', 'user_id' => $bp->displayed_user->id ) );
    392393
    393394    do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid );
     
    418419        $initiator_link = bp_core_get_userlink( $friendship->initiator_user_id );
    419420        $friend_link = bp_core_get_userlink( $friendship->friend_user_id );
    420 
    421         $primary_link = apply_filters( 'friends_activity_friendship_accepted_primary_link', bp_core_get_user_domain( $friendship->initiator_user_id ), &$friendship );
    422421
    423422        /* Record in activity streams for the initiator */
    424423        friends_record_activity( array(
    425424            'user_id' => $friendship->initiator_user_id,
    426             'component_action' => 'friendship_created',
    427             'content' => apply_filters( 'friends_activity_friendship_accepted', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
    428             'primary_link' => $primary_link,
     425            'type' => 'friendship_created',
     426            'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ),
    429427            'item_id' => $friendship_id
    430428        ) );
     
    433431        friends_record_activity( array(
    434432            'user_id' => $friendship->friend_user_id,
    435             'component_action' => 'friendship_created',
    436             'content' => apply_filters( 'friends_activity_friendship_accepted', sprintf( __( '%s and %s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ),
    437             'primary_link' => $primary_link,
     433            'type' => 'friendship_created',
     434            'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ),
    438435            'item_id' => $friendship_id,
    439436            'hide_sitewide' => true /* We've already got the first entry site wide */
Note: See TracChangeset for help on using the changeset viewer.