Ticket #43437: 43437.diff
File 43437.diff, 3.1 KB (added by , 6 years ago) |
---|
-
wp-admin/includes/user.php
diff --git wp-admin/includes/user.php wp-admin/includes/user.php index 4634c8e318..55f25ae9f7 100644
function _wp_personal_data_handle_actions() { 750 750 } 751 751 } 752 752 753 /** 754 * Handle profile page actions. 755 * 756 * @since 757 * @access private 758 */ 759 function _wp_personal_data_handle_profile_actions() { 760 761 if ( isset( $_POST['wp-user-data-request'] ) ) { 762 763 check_admin_referer( 'user-data-request', '_user_data_request_nonce' ); 764 765 $action_type = sanitize_text_field( wp_unslash( $_POST['wp-user-data-request'] ) ); 766 $email_address = sanitize_text_field( wp_unslash( $_POST['email'] ) ); 767 768 if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) { 769 add_settings_error( 770 'action_type', 771 'action_type', 772 __( 'Invalid action.' ), 773 'error' 774 ); 775 } 776 777 $request_id = wp_create_user_request( $email_address, $action_type ); 778 779 if ( is_wp_error( $request_id ) ) { 780 add_settings_error( 781 'user_profile_privacy_request', 782 'user_profile_privacy_request', 783 $request_id->get_error_message(), 784 'error' 785 ); 786 return; 787 } elseif ( ! $request_id ) { 788 add_settings_error( 789 'user_profile_privacy_request', 790 'user_profile_privacy_request', 791 __( 'Unable to initiate confirmation request.' ), 792 'error' 793 ); 794 return; 795 } 796 797 wp_send_user_request( $request_id ); 798 /* 799 add_settings_error( 800 'username_or_email_for_privacy_request', 801 'username_or_email_for_privacy_request', 802 __( 'Confirmation request initiated successfully.' ), 803 'updated' 804 ); 805 */ 806 wp_redirect( add_query_arg( array( 'updated' => 1, 'data-request' => 1 ), self_admin_url( 'profile.php' ) ) ); 807 exit; 808 } 809 } 810 753 811 /** 754 812 * Cleans up failed and expired requests before displaying the list table. 755 813 * -
wp-admin/user-edit.php
diff --git wp-admin/user-edit.php wp-admin/user-edit.php index 3a469a3db0..ae393f777e 100644
if ( is_multisite() 93 93 wp_die( __( 'Sorry, you are not allowed to edit this user.' ) ); 94 94 } 95 95 96 // Check for the data export or delete requests. 97 if ( IS_PROFILE_PAGE ) { 98 _wp_personal_data_handle_profile_actions(); 99 } 100 96 101 // Execute confirmed email change. See send_confirmation_on_profile_email(). 97 102 if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) { 98 103 $new_email = get_user_meta( $current_user->ID, '_new_email', true ); … … if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c 683 688 </tr> 684 689 <?php endif; ?> 685 690 691 <?php if ( IS_PROFILE_PAGE ) : ?> 692 <tr class="data-management-wrap"> 693 <th><label><?php _e( 'Data Management' ); ?></label></th> 694 <td> 695 <button type="submit" class="button" id="wp-export-data" name="wp-user-data-request" value="export_personal_data"><?php _e( 'Export My Data' ); ?></button> 696 <button type="submit" class="button" id="wp-delete-account" name="wp-user-data-request" value="remove_personal_data"><?php _e( 'Delete My Account' ); ?></button> 697 <?php wp_nonce_field( 'user-data-request', '_user_data_request_nonce' ); ?> 698 </td> 699 </tr> 700 <?php endif; ?> 701 686 702 </table> 687 703 688 704 <?php