| 93 | /** |
| 94 | * Adds an activity stream item when a user has uploaded a new avatar. |
| 95 | * |
| 96 | * @package BuddyPress XProfile |
| 97 | * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() |
| 98 | * @uses bp_activity_add() Adds an entry to the activity component tables for a specific activity |
| 99 | */ |
| 100 | function xprofile_new_avatar_activity() { |
| 101 | global $bp; |
| 102 | |
| 103 | if ( !bp_is_active( 'activity' ) ) |
| 104 | return false; |
| 105 | |
| 106 | $user_id = apply_filters( 'xprofile_new_avatar_user_id', $bp->displayed_user->id ); |
| 107 | |
| 108 | $userlink = bp_core_get_userlink( $user_id ); |
| 109 | |
| 110 | bp_activity_add( array( |
| 111 | 'user_id' => $user_id, |
| 112 | 'action' => apply_filters( 'xprofile_new_avatar_action', sprintf( __( '%s uploaded a new profile picture', 'buddypress' ), $userlink ), $user_id ), |
| 113 | 'component' => 'profile', |
| 114 | 'type' => 'new_avatar' |
| 115 | ) ); |
| 116 | } |
| 117 | add_action( 'xprofile_avatar_uploaded', 'xprofile_new_avatar_activity' ); |
| 118 | |