Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/24/2011 03:21:18 AM (15 years ago)
Author:
boonebgorges
Message:

Creates an activity item when users change their avatars. Fixes #3022. Props cnorris23

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-activity.php

    r4249 r4273  
    103103        return apply_filters( 'xprofile_register_activity_action', bp_activity_set_action( $bp->profile->id, $key, $value ), $key, $value );
    104104}
     105
     106/**
     107 * Adds an activity stream item when a user has uploaded a new avatar.
     108 *
     109 * @package BuddyPress XProfile
     110 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     111 * @uses bp_activity_add() Adds an entry to the activity component tables for a specific activity
     112 */
     113function bp_xprofile_new_avatar_activity() {
     114        global $bp;
     115       
     116        if ( !bp_is_active( 'activity' ) )
     117                return false;
     118
     119        $user_id = apply_filters( 'bp_xprofile_new_avatar_user_id', $bp->displayed_user->id );
     120
     121        $userlink = bp_core_get_userlink( $user_id );
     122
     123        bp_activity_add( array(
     124                'user_id' => $user_id,
     125                'action' => apply_filters( 'bp_xprofile_new_avatar_action', sprintf( __( '%s uploaded a new profile picture', 'buddypress' ), $userlink ), $user_id ),
     126                'component' => 'profile',
     127                'type' => 'new_avatar'
     128        ) );
     129}
     130add_action( 'xprofile_avatar_uploaded', 'bp_xprofile_new_avatar_activity' );
    105131?>
Note: See TracChangeset for help on using the changeset viewer.