mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed account submission for password reset;
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -77,15 +77,19 @@ jQuery(document).ready(function() {
|
||||
var password = jQuery('#' + request_action).val();
|
||||
jQuery('.um-field-area-response.' + request_action).hide();
|
||||
|
||||
if ( password === '' ) {
|
||||
if ( jQuery('#' + request_action).length && password === '' ) {
|
||||
jQuery('.um-field-error.' + request_action).show();
|
||||
} else {
|
||||
jQuery('.um-field-error.' + request_action).hide();
|
||||
var request = {
|
||||
request_action: request_action,
|
||||
password: password,
|
||||
nonce: um_scripts.nonce
|
||||
};
|
||||
|
||||
if ( jQuery('#' + request_action).length ) {
|
||||
request.password = password;
|
||||
}
|
||||
|
||||
wp.ajax.send( 'um_request_user_data', {
|
||||
data: request,
|
||||
success: function (data) {
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
jQuery(document).ready(function(){var a=jQuery(".um-account-main").attr("data-current_tab");a&&(jQuery('.um-account-tab[data-tab="'+a+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0)),jQuery(document.body).on("click",".um-account-side li a",function(a){a.preventDefault();var e=jQuery(this);e.parents("ul").find("li a").removeClass("current"),e.addClass("current");var t=jQuery(this).attr("href"),u=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(u),window.history.pushState("","",t),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+u+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+u+'"]').addClass("current"),wp.hooks.doAction("um_after_account_tab_changed",u),!1}),jQuery(document.body).on("click",".um-account-nav a",function(a){a.preventDefault();var e=jQuery(this).attr("data-tab"),t=jQuery(this).parents("div"),u=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(e),jQuery(".um-account-tab").hide(),u.hasClass("current")?(t.next(".um-account-tab").slideUp(),u.removeClass("current")):(t.next(".um-account-tab").slideDown(),u.parents("div").find("a").removeClass("current"),u.addClass("current")),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+e+'"]').addClass("current"),wp.hooks.doAction("um_after_account_tab_changed",e),!1}),jQuery(document.body).on("click",".um-request-button",function(a){a.preventDefault();var e=jQuery(this).data("action"),t=jQuery("#"+e).val();if(jQuery(".um-field-area-response."+e).hide(),""===t)jQuery(".um-field-error."+e).show();else{jQuery(".um-field-error."+e).hide();var u={request_action:e,password:t,nonce:um_scripts.nonce};wp.ajax.send("um_request_user_data",{data:u,success:function(a){jQuery(".um-field-area-response."+e).text(a.answer).show()},error:function(a){console.log(a)}})}})});
|
||||
jQuery(document).ready(function(){var a=jQuery(".um-account-main").attr("data-current_tab");a&&(jQuery('.um-account-tab[data-tab="'+a+'"]').show(),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0)),jQuery(document.body).on("click",".um-account-side li a",function(a){a.preventDefault();var e=jQuery(this);e.parents("ul").find("li a").removeClass("current"),e.addClass("current");var t=jQuery(this).attr("href"),u=jQuery(this).attr("data-tab");return jQuery('input[id="_um_account_tab"]:hidden').val(u),window.history.pushState("","",t),jQuery(".um-account-tab").hide(),jQuery('.um-account-tab[data-tab="'+u+'"]').fadeIn(),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-nav a").removeClass("current"),jQuery('.um-account-nav a[data-tab="'+u+'"]').addClass("current"),wp.hooks.doAction("um_after_account_tab_changed",u),!1}),jQuery(document.body).on("click",".um-account-nav a",function(a){a.preventDefault();var e=jQuery(this).attr("data-tab"),t=jQuery(this).parents("div"),u=jQuery(this);return jQuery('input[id="_um_account_tab"]:hidden').val(e),jQuery(".um-account-tab").hide(),u.hasClass("current")?(t.next(".um-account-tab").slideUp(),u.removeClass("current")):(t.next(".um-account-tab").slideDown(),u.parents("div").find("a").removeClass("current"),u.addClass("current")),jQuery(".um-account-tab:visible").find("input, select, textarea").filter(".um_account_inactive:disabled").removeClass("um_account_inactive").prop("disabled",!1).attr("disabled",!1),jQuery(".um-account-tab:not(:visible)").find("input, select, textarea").not(":disabled").addClass("um_account_inactive").prop("disabled",!0).attr("disabled",!0),jQuery(".um-account-side li a").removeClass("current"),jQuery('.um-account-side li a[data-tab="'+e+'"]').addClass("current"),wp.hooks.doAction("um_after_account_tab_changed",e),!1}),jQuery(document.body).on("click",".um-request-button",function(a){a.preventDefault();var e=jQuery(this).data("action"),t=jQuery("#"+e).val();if(jQuery(".um-field-area-response."+e).hide(),jQuery("#"+e).length&&""===t)jQuery(".um-field-error."+e).show();else{jQuery(".um-field-error."+e).hide();var u={request_action:e,nonce:um_scripts.nonce};jQuery("#"+e).length&&(u.password=t),wp.ajax.send("um_request_user_data",{data:u,success:function(a){jQuery(".um-field-area-response."+e).text(a.answer).show()},error:function(a){console.log(a)}})}})});
|
||||
@@ -134,11 +134,11 @@ $premium['user-locations'] = array(
|
||||
'desc' => 'Using the Google Maps API, display users on a map on the member directory page and allow users to add their location via their profile',
|
||||
);
|
||||
|
||||
//$premium['profile-tabs'] = array(
|
||||
// 'url' => 'https://ultimatemember.com/extensions/profile-tabs/',
|
||||
// 'name' => 'Profile Tabs',
|
||||
// 'desc' => 'Allow users to add custom tabs to profiles',
|
||||
//);
|
||||
$free['jobboardwp'] = array(
|
||||
'url' => 'https://wordpress.org/plugins/um-jobboardwp',
|
||||
'name' => 'JobBoardWP',
|
||||
'desc' => 'Integrates Ultimate Member with the job board plugin <a href="https://wordpress.org/plugins/jobboardwp" target="_blank">JobBoardWP</a>',
|
||||
);
|
||||
|
||||
$free['forumwp'] = array(
|
||||
'url' => 'https://ultimatemember.com/extensions/forumwp/',
|
||||
|
||||
@@ -160,6 +160,10 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
* @throws \Exception
|
||||
*/
|
||||
function ultimatemember_account( $args = array() ) {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
um_fetch_user( get_current_user_id() );
|
||||
|
||||
ob_start();
|
||||
@@ -626,7 +630,10 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
case 'delete':
|
||||
|
||||
$args = 'single_user_password';
|
||||
$args = '';
|
||||
if ( $this->current_password_is_required( $id ) ) {
|
||||
$args = 'single_user_password';
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -660,6 +667,10 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
$output .= UM()->fields()->edit_field( $key, $data );
|
||||
}
|
||||
|
||||
if ( ! $output && ! $this->current_password_is_required( $id ) ) {
|
||||
$output = '<div></div>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'general':
|
||||
@@ -674,7 +685,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
$args = str_replace(',user_email','', $args );
|
||||
}
|
||||
|
||||
if ( UM()->options()->get( 'account_general_password' ) ) {
|
||||
if ( $this->current_password_is_required( $id ) ) {
|
||||
$args .= ',single_user_password';
|
||||
}
|
||||
|
||||
@@ -930,5 +941,34 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
$classes = apply_filters( 'um_form_official_classes__hook', $classes );
|
||||
return $classes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks account actions require current password
|
||||
*
|
||||
* @param $tab_key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function current_password_is_required( $tab_key ) {
|
||||
$is_required = true;
|
||||
|
||||
switch ( $tab_key ) {
|
||||
case 'general':
|
||||
$is_required = UM()->options()->get( 'account_general_password' );
|
||||
break;
|
||||
case 'delete':
|
||||
break;
|
||||
case 'password':
|
||||
break;
|
||||
case 'privacy_erase_data':
|
||||
case 'privacy_download_data':
|
||||
break;
|
||||
}
|
||||
|
||||
$is_required = apply_filters( "um_account_{$tab_key}_require_current", $is_required );
|
||||
|
||||
return $is_required;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2279,7 +2279,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
if ( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) {
|
||||
if ( UM()->account()->current_password_is_required( 'password' ) &&
|
||||
( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) ) {
|
||||
|
||||
$key = 'current_' . $original_key;
|
||||
$output .= '<div ' . $this->get_atts( $key, $classes, $conditional, $data ) . '>';
|
||||
@@ -2302,7 +2303,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
if ( $this->is_error( $key ) ) {
|
||||
$output .= $this->field_error( $this->show_error( $key ) );
|
||||
}else if ( $this->is_notice( $key ) ) {
|
||||
} elseif ( $this->is_notice( $key ) ) {
|
||||
$output .= $this->field_notice( $this->show_notice( $key ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
//$this->post_form['submitted']['role'] = $role;
|
||||
}
|
||||
|
||||
if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ){
|
||||
if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ) {
|
||||
wp_die( 'Hello, spam bot!', 'ultimate-member' );
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
* @return bool
|
||||
*/
|
||||
function is_change_request() {
|
||||
if ( um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1 && isset( $_POST['_um_account_tab'] ) && $_POST['_um_account_tab'] == 'password' ) {
|
||||
if ( isset( $_POST['_um_account'] ) == 1 && isset( $_POST['_um_account_tab'] ) && $_POST['_um_account_tab'] == 'password' ) {
|
||||
return true;
|
||||
} elseif ( isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1 ) {
|
||||
return true;
|
||||
@@ -526,41 +526,41 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
* @param $args
|
||||
*/
|
||||
function um_change_password_errors_hook( $args ) {
|
||||
if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ){
|
||||
wp_die('Hello, spam bot!','ultimate-member');
|
||||
if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ) {
|
||||
wp_die( 'Hello, spam bot!', 'ultimate-member' );
|
||||
}
|
||||
|
||||
if ( ! is_user_logged_in() && isset( $args ) && ! um_is_core_page( 'password-reset' ) ||
|
||||
is_user_logged_in() && isset( $args['user_id'] ) && $args['user_id'] != get_current_user_id() ) {
|
||||
wp_die( __( 'This is not possible for security reasons.','ultimate-member') );
|
||||
wp_die( __( 'This is not possible for security reasons.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $args['user_password'] ) && empty( $args['user_password'] ) ) {
|
||||
UM()->form()->add_error('user_password', __('You must enter a new password','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_password', __( 'You must enter a new password', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( UM()->options()->get( 'reset_require_strongpass' ) ) {
|
||||
|
||||
if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) {
|
||||
UM()->form()->add_error('user_password', __('Your password must contain at least 8 characters','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 8 characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) {
|
||||
UM()->form()->add_error('user_password', __('Your password must contain less than 30 characters','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 30 characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->validation()->strong_pass( $args['user_password'] ) ) {
|
||||
UM()->form()->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least one lowercase letter, one capital letter and one number', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( isset( $args['confirm_user_password'] ) && empty( $args['confirm_user_password'] ) ) {
|
||||
UM()->form()->add_error('confirm_user_password', __('You must confirm your new password','ultimate-member') );
|
||||
UM()->form()->add_error( 'confirm_user_password', __( 'You must confirm your new password', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $args['user_password'] ) && isset( $args['confirm_user_password'] ) && $args['user_password'] != $args['confirm_user_password'] ) {
|
||||
UM()->form()->add_error('confirm_user_password', __('Your passwords do not match','ultimate-member') );
|
||||
UM()->form()->add_error( 'confirm_user_password', __( 'Your passwords do not match', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
/**
|
||||
* Validate for errors in account form
|
||||
*
|
||||
* @param $args
|
||||
* @param array $args
|
||||
*/
|
||||
function um_submit_account_errors_hook( $args ) {
|
||||
|
||||
if ( ! isset( $_POST['um_account_submit'] ) ) {
|
||||
if ( ! isset( $_POST['_um_account'] ) && ! isset( $_POST['_um_account_tab'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,11 +21,13 @@ function um_submit_account_errors_hook( $args ) {
|
||||
switch ( $_POST['_um_account_tab'] ) {
|
||||
case 'delete': {
|
||||
// delete account
|
||||
if ( strlen(trim( $_POST['single_user_password'] ) ) == 0 ) {
|
||||
UM()->form()->add_error( 'single_user_password', __( 'You must enter your password', 'ultimate-member' ) );
|
||||
} else {
|
||||
if ( ! wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
||||
UM()->form()->add_error( 'single_user_password', __( 'This is not your password', 'ultimate-member' ) );
|
||||
if ( UM()->account()->current_password_is_required( 'delete' ) ) {
|
||||
if ( strlen( trim( $_POST['single_user_password'] ) ) == 0 ) {
|
||||
UM()->form()->add_error( 'single_user_password', __( 'You must enter your password', 'ultimate-member' ) );
|
||||
} else {
|
||||
if ( ! wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
||||
UM()->form()->add_error( 'single_user_password', __( 'This is not your password', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,39 +37,53 @@ function um_submit_account_errors_hook( $args ) {
|
||||
}
|
||||
|
||||
case 'password': {
|
||||
|
||||
// change password
|
||||
if ( ( isset( $_POST['current_user_password'] ) && $_POST['current_user_password'] != '' ) ||
|
||||
( isset( $_POST['user_password'] ) && $_POST['user_password'] != '' ) ||
|
||||
( isset( $_POST['confirm_user_password'] ) && $_POST['confirm_user_password'] != '') ) {
|
||||
UM()->account()->current_tab = 'password';
|
||||
|
||||
if ( $_POST['current_user_password'] == '' || ! wp_check_password( $_POST['current_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
||||
if ( empty( $_POST['user_password'] ) ) {
|
||||
UM()->form()->add_error('user_password', __( 'Password is required', 'ultimate-member' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
UM()->form()->add_error('current_user_password', __('This is not your password','ultimate-member') );
|
||||
UM()->account()->current_tab = 'password';
|
||||
} else { // correct password
|
||||
if ( empty( $_POST['confirm_user_password'] ) ) {
|
||||
UM()->form()->add_error('user_password', __( 'Password confirmation is required', 'ultimate-member' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) {
|
||||
UM()->form()->add_error('user_password', __('Your new password does not match','ultimate-member') );
|
||||
UM()->account()->current_tab = 'password';
|
||||
if ( ! empty( $_POST['user_password'] ) && ! empty( $_POST['confirm_user_password'] ) ) {
|
||||
|
||||
if ( UM()->account()->current_password_is_required( 'password' ) ) {
|
||||
if ( empty( $_POST['current_user_password'] ) ) {
|
||||
UM()->form()->add_error('current_user_password', __( 'This is not your password', 'ultimate-member' ) );
|
||||
return;
|
||||
} else {
|
||||
if ( ! wp_check_password( $_POST['current_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
||||
UM()->form()->add_error('current_user_password', __( 'This is not your password', 'ultimate-member' ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( UM()->options()->get( 'account_require_strongpass' ) ) {
|
||||
|
||||
if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) {
|
||||
UM()->form()->add_error('user_password', __('Your password must contain at least 8 characters','ultimate-member') );
|
||||
}
|
||||
|
||||
if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) {
|
||||
UM()->form()->add_error('user_password', __('Your password must contain less than 30 characters','ultimate-member') );
|
||||
}
|
||||
|
||||
if ( ! UM()->validation()->strong_pass( $_POST['user_password'] ) ) {
|
||||
UM()->form()->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimate-member') );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) {
|
||||
UM()->form()->add_error('user_password', __( 'Your new password does not match', 'ultimate-member' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( UM()->options()->get( 'account_require_strongpass' ) ) {
|
||||
if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 8 characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 30 characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! UM()->validation()->strong_pass( $_POST['user_password'] ) ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least one lowercase letter, one capital letter and one number', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -109,7 +124,7 @@ function um_submit_account_errors_hook( $args ) {
|
||||
}
|
||||
|
||||
// check account password
|
||||
if ( UM()->options()->get( 'account_general_password' ) ) {
|
||||
if ( UM()->account()->current_password_is_required( 'general' ) ) {
|
||||
if ( strlen( trim( $_POST['single_user_password'] ) ) == 0 ) {
|
||||
UM()->form()->add_error('single_user_password', __( 'You must enter your password', 'ultimate-member' ) );
|
||||
} else {
|
||||
@@ -185,10 +200,7 @@ function um_submit_account_details( $args ) {
|
||||
|
||||
|
||||
// delete account
|
||||
$user = get_user_by( 'login', um_user( 'user_login' ) );
|
||||
|
||||
if ( 'delete' == $current_tab && isset( $_POST['single_user_password'] ) &&
|
||||
wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
||||
if ( 'delete' == $current_tab ) {
|
||||
if ( current_user_can( 'delete_users' ) || um_user( 'can_delete_profile' ) ) {
|
||||
UM()->user()->delete();
|
||||
|
||||
@@ -415,7 +427,13 @@ add_action( 'um_account_page_hidden_fields', 'um_account_page_hidden_fields' );
|
||||
* Before delete account tab content
|
||||
*/
|
||||
function um_before_account_delete() {
|
||||
printf( __( '%s', 'ultimate-member' ), wpautop( htmlspecialchars( UM()->options()->get( 'delete_account_text' ) ) ) );
|
||||
if ( UM()->account()->current_password_is_required( 'delete' ) ) {
|
||||
$text = UM()->options()->get( 'delete_account_text' );
|
||||
} else {
|
||||
$text = UM()->options()->get( 'delete_account_no_pass_required_text' );
|
||||
}
|
||||
|
||||
printf( __( '%s', 'ultimate-member' ), wpautop( htmlspecialchars( $text ) ) );
|
||||
}
|
||||
add_action( 'um_before_account_delete', 'um_before_account_delete' );
|
||||
|
||||
@@ -530,17 +548,29 @@ function um_after_account_privacy( $args ) {
|
||||
echo '<p>' . esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ) . '</p>';
|
||||
} elseif ( ! empty( $pending ) && $pending['post_status'] == 'request-confirmed' ) {
|
||||
echo '<p>' . esc_html__( 'The administrator has not yet approved downloading the data. Please expect an email with a link to your data.', 'ultimate-member' ) . '</p>';
|
||||
} else { ?>
|
||||
<label name="um-export-data">
|
||||
<?php esc_html_e( 'Enter your current password to confirm a new export of your personal data.', 'ultimate-member' ); ?>
|
||||
</label>
|
||||
<div class="um-field-area">
|
||||
<input id="um-export-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' )?>">
|
||||
<div class="um-field-error um-export-data">
|
||||
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
|
||||
} else {
|
||||
if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) { ?>
|
||||
|
||||
<label name="um-export-data">
|
||||
<?php esc_html_e( 'Enter your current password to confirm a new export of your personal data.', 'ultimate-member' ); ?>
|
||||
</label>
|
||||
<div class="um-field-area">
|
||||
<input id="um-export-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' )?>">
|
||||
<div class="um-field-error um-export-data">
|
||||
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
|
||||
</div>
|
||||
<div class="um-field-area-response um-export-data"></div>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<label name="um-export-data">
|
||||
<?php esc_html_e( 'To export of your personal data, click the button below.', 'ultimate-member' ); ?>
|
||||
</label>
|
||||
<div class="um-field-area-response um-export-data"></div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<a class="um-request-button um-export-data-button" data-action="um-export-data" href="javascript:void(0);">
|
||||
<?php esc_html_e( 'Request data', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
@@ -592,15 +622,27 @@ function um_after_account_privacy( $args ) {
|
||||
echo '<p>' . esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ) . '</p>';
|
||||
} elseif ( ! empty( $pending ) && $pending['post_status'] == 'request-confirmed' ) {
|
||||
echo '<p>' . esc_html__( 'The administrator has not yet approved deleting your data. Please expect an email with a link to your data.', 'ultimate-member' ) . '</p>';
|
||||
} else { ?>
|
||||
<label name="um-erase-data">
|
||||
<?php esc_html_e( 'Enter your current password to confirm the erasure of your personal data.', 'ultimate-member' ); ?>
|
||||
<input id="um-erase-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' )?>">
|
||||
<div class="um-field-error um-erase-data">
|
||||
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
|
||||
</div>
|
||||
<div class="um-field-area-response um-erase-data"></div>
|
||||
</label>
|
||||
} else {
|
||||
if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) { ?>
|
||||
|
||||
<label name="um-erase-data">
|
||||
<?php esc_html_e( 'Enter your current password to confirm the erasure of your personal data.', 'ultimate-member' ); ?>
|
||||
<input id="um-erase-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' )?>">
|
||||
<div class="um-field-error um-erase-data">
|
||||
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
|
||||
</div>
|
||||
<div class="um-field-area-response um-erase-data"></div>
|
||||
</label>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<label name="um-erase-data">
|
||||
<?php esc_html_e( 'Require erasure of your personal data, click on the button below.', 'ultimate-member' ); ?>
|
||||
<div class="um-field-area-response um-erase-data"></div>
|
||||
</label>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<a class="um-request-button um-erase-data-button" data-action="um-erase-data" href="javascript:void(0);">
|
||||
<?php esc_html_e( 'Request data erase', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
@@ -615,37 +657,48 @@ function um_after_account_privacy( $args ) {
|
||||
function um_request_user_data() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
if ( ! isset( $_POST['request_action'] ) ) {
|
||||
wp_send_json_error( __( 'Wrong request.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
$password = $_POST['password'];
|
||||
$password = ! empty( $_POST['password'] ) ? $_POST['password'] : '';
|
||||
$user = get_userdata( $user_id );
|
||||
$hash = $user->data->user_pass;
|
||||
|
||||
if ( wp_check_password( $password, $hash ) && isset( $_POST['request_action'] ) ) {
|
||||
|
||||
if ( $_POST['request_action'] == 'um-export-data' ) {
|
||||
$request_id = wp_create_user_request( $user->data->user_email, 'export_personal_data' );
|
||||
} elseif ( $_POST['request_action'] == 'um-erase-data' ) {
|
||||
$request_id = wp_create_user_request( $user->data->user_email, 'remove_personal_data' );
|
||||
if ( $_POST['request_action'] == 'um-export-data' ) {
|
||||
if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) {
|
||||
if ( ! wp_check_password( $password, $hash ) ) {
|
||||
$answer = esc_html__( 'The password you entered is incorrect.', 'ultimate-member' );
|
||||
wp_send_json_success( array( 'answer' => $answer ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $request_id ) ) {
|
||||
wp_send_json_error( __( 'Wrong request.', 'ultimate-member' ) );
|
||||
} elseif ( $_POST['request_action'] == 'um-erase-data' ) {
|
||||
if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) {
|
||||
if ( ! wp_check_password( $password, $hash ) ) {
|
||||
$answer = esc_html__( 'The password you entered is incorrect.', 'ultimate-member' );
|
||||
wp_send_json_success( array( 'answer' => $answer ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_wp_error( $request_id ) ) {
|
||||
$answer = $request_id->get_error_message();
|
||||
} else {
|
||||
wp_send_user_request( $request_id );
|
||||
$answer = esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$answer = esc_html__( 'The password you entered is incorrect.', 'ultimate-member' );
|
||||
|
||||
}
|
||||
|
||||
wp_send_json_success( array( 'answer' => esc_html( $answer ) ) );
|
||||
if ( $_POST['request_action'] == 'um-export-data' ) {
|
||||
$request_id = wp_create_user_request( $user->data->user_email, 'export_personal_data' );
|
||||
} elseif ( $_POST['request_action'] == 'um-erase-data' ) {
|
||||
$request_id = wp_create_user_request( $user->data->user_email, 'remove_personal_data' );
|
||||
}
|
||||
|
||||
if ( ! isset( $request_id ) || empty( $request_id ) ) {
|
||||
wp_send_json_error( __( 'Wrong request.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( is_wp_error( $request_id ) ) {
|
||||
$answer = esc_html( $request_id->get_error_message() );
|
||||
} else {
|
||||
wp_send_user_request( $request_id );
|
||||
$answer = esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' );
|
||||
}
|
||||
|
||||
wp_send_json_success( array( 'answer' => $answer ) );
|
||||
}
|
||||
add_action( 'wp_ajax_nopriv_um_request_user_data', 'um_request_user_data' );
|
||||
add_action( 'wp_ajax_um_request_user_data', 'um_request_user_data' );
|
||||
@@ -28,7 +28,7 @@ function um_add_security_checks( $args ) {
|
||||
|
||||
<p class="<?php echo esc_attr( UM()->honeypot ); ?>_name">
|
||||
<label for="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>"><?php _e( 'Only fill in if you are not human' ); ?></label>
|
||||
<input type="text" name="<?php echo esc_attr( UM()->honeypot ); ?>" id="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
<input type="hidden" name="<?php echo esc_attr( UM()->honeypot ); ?>" id="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -58,7 +58,7 @@ function um_add_form_honeypot_js() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery( window ).on( 'load', function() {
|
||||
jQuery("input[name='<?php echo esc_js( UM()->honeypot ); ?>']").val('');
|
||||
jQuery('input[name="<?php echo esc_js( UM()->honeypot ); ?>"]').val('');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
+14
-4
@@ -6,8 +6,8 @@ Donate link:
|
||||
Tags: community, member, membership, user-profile, user-registration
|
||||
Requires PHP: 5.6
|
||||
Requires at least: 5.0
|
||||
Tested up to: 5.4.1
|
||||
Stable tag: 2.1.6
|
||||
Tested up to: 5.5
|
||||
Stable tag: 2.1.7
|
||||
License: GNU Version 2 or Any Later Version
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
@@ -67,6 +67,7 @@ Ultimate Member has a range of extensions that allow you to extend the power of
|
||||
|
||||
= Free Extensions =
|
||||
|
||||
* [JobsBoardWP](https://wordpress.org/plugins/um-jobboardwp) - This free extension integrates Ultimate Member with the job board plugin [JobBoardWP](https://wordpress.org/plugins/jobboardwp).
|
||||
* [ForumWP](https://ultimatemember.com/extensions/forumwp/) - This free extension integrates Ultimate Member with the forum plugin [ForumWP](https://forumwpplugin.com).
|
||||
* [Terms & Conditions](https://ultimatemember.com/extensions/terms-conditions/) - Add a terms and condition checkbox to your registration forms & require users to agree to your T&Cs before registering on your site.
|
||||
* [Google reCAPTCHA](https://ultimatemember.com/extensions/google-recaptcha/) - Stop bots on your registration & login forms with Google reCAPTCHA
|
||||
@@ -153,11 +154,20 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
* To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0)
|
||||
* UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin
|
||||
|
||||
= 2.1.7: July xx, 2020 =
|
||||
= 2.1.7: August 05, 2020 =
|
||||
|
||||
- Added dependency functions for plugins: [Ultimate Member - JobBoardWP integration](https://wordpress.org/plugins/um-jobboardwp) & [JobBoardWP](https://wordpress.org/plugins/jobboardwp)
|
||||
- Added account privacy setting for the avoiding profile indexation
|
||||
- Added setting "Change image orientation" based on image EXIF data
|
||||
- Added setting "Account Deletion without password Custom Text"
|
||||
- Fixed security lacks for 'redirect_to' attributes
|
||||
- Fixed member directory roles in query (the case when selected some roles, but current user can see another only)
|
||||
- Fixed member directory sorting
|
||||
- Fixed member directory list dropdown init after changing view type
|
||||
- Fixed validation when using HTML in textarea
|
||||
- Fixed cleaning user old uploads
|
||||
- Fixed conditional logic for file/image-type fields
|
||||
- Fixed "get_profile_photo_size" function (avoid PHP notice with array_combine )
|
||||
- Fixed "get_profile_photo_size" function (avoid PHP notice with array_combine)
|
||||
- Fixed password reset/change form when other forms are initialized at the same page
|
||||
- Fixed getting extension updates on multisites
|
||||
- Fixed the 'wp_authenticate_user' filter's variables (changed username string to WP_User object)
|
||||
|
||||
Reference in New Issue
Block a user