Skip to content

Commit 30f2d87

Browse files
committed
Merge pull request #1 from Automattic/set-upload-action
Set upload action to ensure fileservice filters are run.
2 parents 081a475 + 9be54cd commit 30f2d87

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

files.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* for a given user or group. Our filter on `bp_core_avatar_folder_dir()` prevents this happening,
4747
* and our filter on `bp_core_fetch_avatar_no_grav` will make the code flow to this
4848
* bp_core_default_avatar_* filter.
49-
*
49+
*
5050
* It's normally used to override the fallback image for Gravatar, but by duplicating some logic, we
5151
* use it to here to set a custom URL to support VIP Go FHS without any core changes to BuddyPress.
5252
*
@@ -81,7 +81,7 @@ function vipbp_filter_user_avatar_urls( $_, $params ) {
8181
* for a given user or group. Our filter on `bp_core_avatar_folder_dir()` prevents this happening,
8282
* and our filter on `bp_core_fetch_avatar_no_grav` will make the code flow to this
8383
* bp_core_default_avatar_* filter.
84-
*
84+
*
8585
* It's normally used to override the fallback image for Gravatar, but by duplicating some logic, we
8686
* use it to here to set a custom URL to support VIP Go FHS without any core changes to BuddyPress.
8787
*
@@ -323,7 +323,7 @@ function vipbp_handle_avatar_upload( $_, $file, $upload_dir_filter ) {
323323
// Upload file.
324324
$uploaded_file = $file['file'];
325325
$result = wp_handle_upload( $uploaded_file, array(
326-
'action' => '',
326+
'action' => 'wp_handle_upload', // Matches Core's action for uploads, to ensure VIP Go fileservice filters are applied
327327
'test_form' => false,
328328
) );
329329

@@ -491,7 +491,7 @@ function vip_handle_cover_image_upload( $_, $args, $needs_reset, $object_data )
491491
// Upload file.
492492
$uploaded_file = $_FILES['file'];
493493
$result = wp_handle_upload( $uploaded_file, array(
494-
'action' => '',
494+
'action' => 'wp_handle_upload', // Matches Core's action for uploads, to ensure VIP Go fileservice filters are applied
495495
'test_form' => false,
496496
) );
497497

@@ -592,7 +592,7 @@ function vipbp_handle_avatar_crop( $_, $args ) {
592592
} elseif ( $args['object'] === 'group' ) {
593593
$meta = groups_get_groupmeta( (int) $args['item_id'], 'vipbp-' . $args['avatar_dir'], true );
594594
$meta = wp_parse_args( $cropping_meta, $meta );
595-
groups_update_groupmeta( (int) $args['item_id'], 'vipbp-' . $args['avatar_dir'], $meta );
595+
groups_update_groupmeta( (int) $args['item_id'], 'vipbp-' . $args['avatar_dir'], $meta );
596596
}
597597

598598
if ( $switched ) {
@@ -676,7 +676,7 @@ function vipbp_delete_existing_avatar( $_, $args ) {
676676

677677
} elseif ( $args['object'] === 'group' ) {
678678
$meta = groups_get_groupmeta( (int) $args['item_id'], 'vipbp-' . $args['avatar_dir'], true );
679-
groups_delete_groupmeta( (int) $args['item_id'], 'vipbp-' . $args['avatar_dir'] );
679+
groups_delete_groupmeta( (int) $args['item_id'], 'vipbp-' . $args['avatar_dir'] );
680680
}
681681

682682
if ( $meta ) {

0 commit comments

Comments
 (0)