Skip to:
Content

BuddyPress.org

Changeset 1749 for trunk/bp-friends.php


Ignore:
Timestamp:
09/01/2009 01:45:37 AM (17 years ago)
Author:
apeatling
Message:

Centrally registered activity actions in $bp->activity->actions. This will be used to add privacy support to activity feeds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends.php

    r1723 r1749  
    4747    $bp->friends->format_notification_function = 'friends_format_notifications';
    4848    $bp->friends->slug = BP_FRIENDS_SLUG;
     49
     50    /* Register the activity stream actions for this component */
     51    friends_register_activity_action( 'friendship_created', __( 'New friendship created', 'buddypress' ) );
    4952
    5053    /* Register this in the active components array */
     
    290293   
    291294    switch( $action ) {
    292         case 'friendship_accepted':
     295        case 'friendship_created':
    293296            $friendship = new BP_Friends_Friendship( $item_id, false, false );
    294297
     
    323326}
    324327
     328function friends_register_activity_action( $key, $value ) {
     329    global $bp;
     330   
     331    if ( !function_exists( 'bp_activity_set_action' ) )
     332        return false;
     333   
     334    return apply_filters( 'friends_register_activity_action', bp_activity_set_action( $bp->friends->id, $key, $value ), $key, $value );
     335}
     336
    325337function friends_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) {
    326338    global $bp;
     
    636648       
    637649        // Record in activity streams
    638         friends_record_activity( array( 'item_id' => $friendship_id, 'component_name' => $bp->friends->slug, 'component_action' => 'friendship_accepted', 'is_private' => 0, 'user_id' => $friendship->initiator_user_id, 'secondary_user_id' => $friendship->friend_user_id ) );
     650        friends_record_activity( array( 'item_id' => $friendship_id, 'component_name' => $bp->friends->slug, 'component_action' => 'friendship_created', 'is_private' => 0, 'user_id' => $friendship->initiator_user_id, 'secondary_user_id' => $friendship->friend_user_id ) );
    639651       
    640652        // Send the email notification
Note: See TracChangeset for help on using the changeset viewer.