fix 'um_resize_image' action at registration form

This commit is contained in:
denisbaranov
2020-01-27 15:22:28 +02:00
parent e05ec09e98
commit 230dd24816
3 changed files with 15 additions and 2 deletions
+10
View File
@@ -102,6 +102,14 @@ jQuery(document).ready(function() {
user_id = jQuery(this).parents('#um_upload_single').data('user_id');
}
var form_id = 0;
var mode = '';
if ( jQuery('div.um-field-image[data-key="' + key + '"]').length === 1 ) {
var $formWrapper = jQuery('div.um-field-image[data-key="' + key + '"]').closest('.um-form');
form_id = $formWrapper.find('input[name="form_id"]').val();
mode = $formWrapper.attr('data-mode');
}
if ( coord ) {
jQuery(this).html( jQuery(this).attr('data-processing') ).addClass('disabled');
@@ -116,6 +124,8 @@ jQuery(document).ready(function() {
coord : coord,
user_id : user_id,
key: key,
set_id: form_id,
set_mode: mode,
nonce: um_scripts.nonce
},
success: function( response ) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -326,7 +326,10 @@ if ( ! class_exists( 'um\core\Files' ) ) {
$user_id = empty( $_REQUEST['user_id'] ) ? get_current_user_id() : $_REQUEST['user_id'];
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
UM()->fields()->set_id = filter_input( INPUT_POST, 'set_id', FILTER_SANITIZE_NUMBER_INT );
UM()->fields()->set_mode = filter_input( INPUT_POST, 'set_mode', FILTER_SANITIZE_STRING );
if ( UM()->fields()->set_mode != 'register' && ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
$ret['error'] = esc_js( __( 'You haven\'t ability to edit this user', 'ultimate-member' ) );
wp_send_json_error( $ret );
}