Skip to:
Content

BuddyPress.org

Changeset 11393


Ignore:
Timestamp:
01/19/2017 08:11:48 PM (5 years ago)
Author:
djpaul
Message:

Groups: fire groups_avatar_uploaded action after uploading avatar during group creation process.

Fixes #7371

Props jdgrimes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-actions.php

    r11313 r11393  
    359359        // If the image cropping is done, crop the image and save a full/thumb version.
    360360        if ( isset( $_POST['avatar-crop-submit'] ) && isset( $_POST['upload'] ) ) {
     361
    361362            // Normally we would check a nonce here, but the group save nonce is used instead.
    362             if ( !bp_core_avatar_handle_crop( array( 'object' => 'group', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
     363            $args = array(
     364                'object'        => 'group',
     365                'avatar_dir'    => 'group-avatars',
     366                'item_id'       => $bp->groups->current_group->id,
     367                'original_file' => $_POST['image_src'],
     368                'crop_x'        => $_POST['x'],
     369                'crop_y'        => $_POST['y'],
     370                'crop_w'        => $_POST['w'],
     371                'crop_h'        => $_POST['h']
     372            );
     373
     374            if ( ! bp_core_avatar_handle_crop( $args ) ) {
    363375                bp_core_add_message( __( 'There was an error saving the group profile photo, please try uploading again.', 'buddypress' ), 'error' );
    364             else
     376            } else {
     377                /**
     378                 * Fires after a group avatar is uploaded.
     379                 *
     380                 * @since 2.8.0
     381                 *
     382                 * @param int    $group_id ID of the group.
     383                 * @param string $type     Avatar type. 'crop' or 'full'.
     384                 * @param array  $args     Array of parameters passed to the avatar handler.
     385                 */
     386                do_action( 'groups_avatar_uploaded', bp_get_current_group_id(), 'crop', $args );
     387
    365388                bp_core_add_message( __( 'The group profile photo was uploaded successfully.', 'buddypress' ) );
     389            }
    366390        }
    367391    }
Note: See TracChangeset for help on using the changeset viewer.