Skip to:
Content

BuddyPress.org

Ticket #3022: 3022.03.patch

File 3022.03.patch, 1.2 KB (added by cnorris23, 14 years ago)
  • bp-xprofile/bp-xprofile-functions.php

     
    9090        }
    9191}
    9292
     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 */
     100function bp_xprofile_new_avatar_activity() {
     101        global $bp;
     102
     103        if ( !bp_is_active( 'activity' ) )
     104                return false;
     105
     106        $user_id = apply_filters( 'bp_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( 'bp_xprofile_new_avatar_action', sprintf( __( '%s uploaded a new profile picture', 'buddypress' ), $userlink ), $user_id ),
     113                'component' => 'profile',
     114                'type' => 'new_avatar'
     115        ) );
     116}
     117add_action( 'bp_xprofile_avatar_uploaded', 'bp_xprofile_new_avatar_activity' );
     118
    93119function xprofile_register_activity_action( $key, $value ) {
    94120        global $bp;
    95121