Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/11/2021 01:40:24 PM (2 years ago)
Author:
imath
Message:

Make sure the new_avatar activity can use the avatar crop results

Since [13175] the BP_Attachment_Avatar::crop() method include the timestamp the avatar was generated on into its returned array. This array is now transported into the action the function creating a new_avatar activity hooks to. This function (bp_members_new_avatar_activity()) now accepts 3 more parameters included the transported crop results. This makes it possible to use the timestamp when the avatar was generated on as the new_avatar activity recorded time. Doing so, we don't need to add an extra activity meta to store the name of the avatar file to be sure to display the avatar the user had at the time the activity was created.

Props vapvarun, oztaser

See #8581

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/screens/single/admin/group-avatar.php

    r11923 r13177  
    7575        );
    7676
    77         if ( !bp_core_avatar_handle_crop( $args ) ) {
     77        $cropped_avatar = bp_core_avatar_handle_crop( $args, 'array' );
     78
     79        if ( ! $cropped_avatar ) {
    7880            bp_core_add_message( __( 'There was a problem cropping the group profile photo.', 'buddypress' ), 'error' );
    7981        } else {
     
    8284             *
    8385             * @since 2.8.0
     86             * @since 10.0.0 Adds a new param: an array containing the full, thumb avatar and the timestamp.
    8487             *
    85              * @param int    $group_id ID of the group.
    86              * @param string $type     Avatar type. 'crop' or 'full'.
    87              * @param array  $args     Array of parameters passed to the avatar handler.
     88             * @param int    $group_id       ID of the group.
     89             * @param string $type           Avatar type. 'crop' or 'camera'.
     90             * @param array  $args           Array of parameters passed to the avatar handler.
     91             * @param array  $cropped_avatar Array containing the full, thumb avatar and the timestamp.
    8892             */
    89             do_action( 'groups_avatar_uploaded', bp_get_current_group_id(), 'crop', $args );
     93            do_action( 'groups_avatar_uploaded', bp_get_current_group_id(), 'crop', $args, $cropped_avatar );
    9094            bp_core_add_message( __( 'The new group profile photo was uploaded successfully.', 'buddypress' ) );
    9195        }
Note: See TracChangeset for help on using the changeset viewer.