diff --git a/assets/css/um-account.css b/assets/css/um-account.css index 89b84b1a..9a922044 100644 --- a/assets/css/um-account.css +++ b/assets/css/um-account.css @@ -205,4 +205,30 @@ color: #444; font-weight: bold; text-decoration: none !important; +} + +.um-field-export_data .um-field-error { + display: none; +} + +.um-field-export_data .um-field-area-response { + display: none; + line-height: 1.5; + padding: 10px 0; +} + +.um-request-button { + display: inline-block; + background-color: #3ba1da; + border-radius: 5px; + color: #fff; + margin: 10px 0 0; + padding: 5px 10px; + text-decoration: none; +} + +.um-request-button:hover { + background-color: #44b0ec; + color: #fff; + text-decoration: none; } \ No newline at end of file diff --git a/assets/js/um-account.js b/assets/js/um-account.js index ba033531..a4587bb2 100644 --- a/assets/js/um-account.js +++ b/assets/js/um-account.js @@ -64,4 +64,35 @@ jQuery(document).ready(function() { return false; }); + + + jQuery(document.body).on( 'click', '.um-request-button', function(e) { + e.preventDefault(); + + var request_action = jQuery(this).data('action'); + var password = jQuery('#'+request_action).val(); + jQuery('.um-field-area-response.'+request_action).hide(); + + if( 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 + }; + wp.ajax.send('um_request_user_data', { + data: request, + success: function (data) { + jQuery('.um-field-area-response.'+request_action).text(data.answer).show(); + }, + error: function (data) { + console.log(data); + } + }); + } + + }); + }); \ No newline at end of file diff --git a/includes/core/um-actions-account.php b/includes/core/um-actions-account.php index dc6d65c1..2389ac0b 100644 --- a/includes/core/um-actions-account.php +++ b/includes/core/um-actions-account.php @@ -463,4 +463,100 @@ add_action( 'um_after_user_account_updated', 'um_account_updated_notification', function um_disable_native_email_notificatiion( $changed, $user_id ) { add_filter( 'send_email_change_email', '__return_false' ); } -add_action( 'um_account_pre_update_profile', 'um_disable_native_email_notificatiion', 10, 2 ); \ No newline at end of file +add_action( 'um_account_pre_update_profile', 'um_disable_native_email_notificatiion', 10, 2 ); + + +/** + * Add export and erase user's data in privacy tab + * + * @param $args + */ +add_action( 'um_after_account_privacy', 'um_after_account_privacy' ); +function um_after_account_privacy( $args ) { + ?> + +
+ +