Skip to:
Content

BuddyPress.org

Changeset 4273


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

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

Location:
trunk/bp-xprofile
Files:
2 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?>
  • trunk/bp-xprofile/bp-xprofile-loader.php

    r4211 r4273  
    3838            'cache',
    3939            'actions',
     40            'activity',
    4041            'screens',
    4142            'classes',
Note: See TracChangeset for help on using the changeset viewer.