mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 22:23:37 +09:00
- fixed files/images upload download;
This commit is contained in:
@@ -245,7 +245,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
if ( $coord_n != 3 ) {
|
||||
wp_send_json_error( esc_js( __( 'Invalid coordinates', 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
|
||||
$image_path = um_is_file_owner( $src, $user_id, true );
|
||||
if ( ! $image_path ) {
|
||||
wp_send_json_error( esc_js( __( 'Invalid file ownership', 'ultimate-member' ) ) );
|
||||
@@ -275,7 +275,6 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
UM()->fields()->set_id = $_POST['set_id'];
|
||||
UM()->fields()->set_mode = $_POST['set_mode'];
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -297,26 +296,24 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$um_image_upload_nonce = apply_filters("um_image_upload_nonce", true );
|
||||
$um_image_upload_nonce = apply_filters( "um_image_upload_nonce", true );
|
||||
|
||||
if( $um_image_upload_nonce ){
|
||||
if ( $um_image_upload_nonce ) {
|
||||
if ( ! wp_verify_nonce( $nonce, "um_upload_nonce-{$timestamp}" ) && is_user_logged_in() ) {
|
||||
// This nonce is not valid.
|
||||
$ret['error'] = 'Invalid nonce';
|
||||
$ret['error'] = __( 'Invalid nonce', 'ultimate-member' );
|
||||
wp_send_json_error( $ret );
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
if( ! is_array( $_FILES[ $id ]['name'] ) ) {
|
||||
if ( isset( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
if ( ! is_array( $_FILES[ $id ]['name'] ) ) {
|
||||
|
||||
$uploaded = UM()->uploader()->upload_image( $_FILES[ $id ], $user_id, $id );
|
||||
if ( isset( $uploaded['error'] ) ){
|
||||
|
||||
$ret['error'] = $uploaded['error'];
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$ts = current_time( 'timestamp' );
|
||||
$ret[ ] = $uploaded['handle_upload'];
|
||||
}
|
||||
@@ -324,7 +321,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret['error'] = __('A theme or plugin compatibility issue','ultimate-member');
|
||||
$ret['error'] = __( 'A theme or plugin compatibility issue', 'ultimate-member' );
|
||||
}
|
||||
wp_send_json_success( $ret );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user