Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/24/2015 10:28:21 AM (9 years ago)
Author:
imath
Message:

Make sure the xprofile_avatar_uploaded action is fired once the avatar of the user is set.

In 2.3.0, we introduced a new UI to manage avatar. It now uses Ajax to upload and set the avatar. Unfortunately a confusion was made about the xprofile_avatar_uploaded action. It was firing immediately after the avatar was uploaded but before it has been set using the cropping tool.

This commit is:

  • making sure the action is fired at the right time
  • adding new parameters to the action to inform about the User ID and the way the avatar was set ("crop" or "camera")
  • making sure an activity will be generated if the avatar was set within the wp-admin/extended-profile.

Props r-a-y, landwire

See #6612 (branch 2.3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/src/bp-xprofile/bp-xprofile-screens.php

    r9819 r10134  
    264264             * Fires right before the redirect, after processing a new avatar.
    265265             *
    266              * @since BuddyPress (1.1.0)
     266             * @since 1.1.0
     267             * @since 2.3.4 Add two new parameters to inform about the user id and
     268             *              about the way the avatar was set (eg: 'crop' or 'camera')
     269             *
     270             * @param string $item_id Inform about the user id the avatar was set for
     271             * @param string $value Inform about the way the avatar was set ('crop')
    267272             */
    268             do_action( 'xprofile_avatar_uploaded' );
     273            do_action( 'xprofile_avatar_uploaded', (int) $args['item_id'], 'crop' );
    269274            bp_core_add_message( __( 'Your new profile photo was uploaded successfully.', 'buddypress' ) );
    270275            bp_core_redirect( bp_displayed_user_domain() );
Note: See TracChangeset for help on using the changeset viewer.