Skip to content

Commit 081a475

Browse files
committed
Fix media uploads submitted via non-AJAX POST.
1 parent 0419793 commit 081a475

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

files.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ function vipbp_handle_avatar_upload( $_, $file, $upload_dir_filter ) {
305305
$switched = true;
306306
}
307307

308+
if ( ! function_exists( 'wp_handle_upload' ) ) {
309+
require_once( ABSPATH . '/wp-admin/includes/file.php' );
310+
}
311+
308312
$bp = buddypress();
309313
$crop_image_width = bp_core_avatar_original_max_width();
310314
$crop_ui_available_width = 0;
@@ -412,6 +416,10 @@ function vipbp_handle_avatar_capture( $_, $data, $item_id ) {
412416
$switched = true;
413417
}
414418

419+
if ( ! function_exists( 'wp_tempnam' ) ) {
420+
require_once( ABSPATH . '/wp-admin/includes/file.php' );
421+
}
422+
415423
// Save bytestream to disk.
416424
$tmp_name = wp_tempnam();
417425
file_put_contents( $tmp_name, $data );
@@ -474,6 +482,10 @@ function vip_handle_cover_image_upload( $_, $args, $needs_reset, $object_data )
474482
$switched = true;
475483
}
476484

485+
if ( ! function_exists( 'wp_handle_upload' ) ) {
486+
require_once( ABSPATH . '/wp-admin/includes/file.php' );
487+
}
488+
477489
$bp = buddypress();
478490

479491
// Upload file.

0 commit comments

Comments
 (0)