Privacy: add user information to the personal data export file.
Props TZ-Media, desrosj. See #43547. Built from https://develop.svn.wordpress.org/trunk@43055 git-svn-id: http://core.svn.wordpress.org/trunk@42884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c77a8ed2fc
commit
f4e6b7a29c
|
@ -352,6 +352,7 @@ add_action( 'user_request_action_confirmed', '_wp_privacy_account_request_confir
|
||||||
add_filter( 'user_request_action_confirmed_message', '_wp_privacy_account_request_confirmed_message', 10, 2 );
|
add_filter( 'user_request_action_confirmed_message', '_wp_privacy_account_request_confirmed_message', 10, 2 );
|
||||||
add_filter( 'wp_privacy_personal_data_exporters', 'wp_register_comment_personal_data_exporter' );
|
add_filter( 'wp_privacy_personal_data_exporters', 'wp_register_comment_personal_data_exporter' );
|
||||||
add_filter( 'wp_privacy_personal_data_exporters', 'wp_register_media_personal_data_exporter' );
|
add_filter( 'wp_privacy_personal_data_exporters', 'wp_register_media_personal_data_exporter' );
|
||||||
|
add_filter( 'wp_privacy_personal_data_exporters', 'wp_register_user_personal_data_exporter' );
|
||||||
add_filter( 'wp_privacy_personal_data_erasers', 'wp_register_comment_personal_data_eraser' );
|
add_filter( 'wp_privacy_personal_data_erasers', 'wp_register_comment_personal_data_eraser' );
|
||||||
add_action( 'init', 'wp_schedule_delete_old_privacy_export_files' );
|
add_action( 'init', 'wp_schedule_delete_old_privacy_export_files' );
|
||||||
add_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' );
|
add_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' );
|
||||||
|
|
|
@ -2825,6 +2825,105 @@ function _wp_privacy_action_request_types() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the personal data exporter for users.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param array $exporters An array of personal data exporters.
|
||||||
|
* @return array An array of personal data exporters.
|
||||||
|
*/
|
||||||
|
function wp_register_user_personal_data_exporter( $exporters ) {
|
||||||
|
$exporters[] = array(
|
||||||
|
'exporter_friendly_name' => __( 'WordPress User' ),
|
||||||
|
'callback' => 'wp_user_personal_data_exporter',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $exporters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds and exports personal data associated with an email address from the user and user_meta table.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param string $email_address The users email address.
|
||||||
|
* @return array An array of personal data.
|
||||||
|
*/
|
||||||
|
function wp_user_personal_data_exporter( $email_address ) {
|
||||||
|
$email_address = trim( $email_address );
|
||||||
|
|
||||||
|
$data_to_export = array();
|
||||||
|
|
||||||
|
$user = get_user_by( 'email', $email_address );
|
||||||
|
|
||||||
|
if ( ! $user ) {
|
||||||
|
return array(
|
||||||
|
'data' => array(),
|
||||||
|
'done' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_meta = get_user_meta( $user->ID );
|
||||||
|
|
||||||
|
$user_prop_to_export = array(
|
||||||
|
'ID' => __( 'User ID' ),
|
||||||
|
'user_login' => __( 'User Login Name' ),
|
||||||
|
'user_nicename' => __( 'User Nice Name' ),
|
||||||
|
'user_email' => __( 'User Email' ),
|
||||||
|
'user_url' => __( 'User URL' ),
|
||||||
|
'user_registered' => __( 'User Registration Date' ),
|
||||||
|
'display_name' => __( 'User Display Name' ),
|
||||||
|
'nickname' => __( 'User Nickname' ),
|
||||||
|
'first_name' => __( 'User First Name' ),
|
||||||
|
'last_name' => __( 'User Last Name' ),
|
||||||
|
'description' => __( 'User Description' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
$user_data_to_export = array();
|
||||||
|
|
||||||
|
foreach ( $user_prop_to_export as $key => $name ) {
|
||||||
|
$value = '';
|
||||||
|
|
||||||
|
switch ( $key ) {
|
||||||
|
case 'ID':
|
||||||
|
case 'user_login':
|
||||||
|
case 'user_nicename':
|
||||||
|
case 'user_email':
|
||||||
|
case 'user_url':
|
||||||
|
case 'user_registered':
|
||||||
|
case 'display_name':
|
||||||
|
$value = $user->data->$key;
|
||||||
|
break;
|
||||||
|
case 'nickname':
|
||||||
|
case 'first_name':
|
||||||
|
case 'last_name':
|
||||||
|
case 'description':
|
||||||
|
$value = $user_meta[ $key ][0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $value ) ) {
|
||||||
|
$user_data_to_export[] = array(
|
||||||
|
'name' => $name,
|
||||||
|
'value' => $value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_to_export[] = array(
|
||||||
|
'group_id' => 'user',
|
||||||
|
'group_label' => __( 'User' ),
|
||||||
|
'item_id' => "user-{$user->ID}",
|
||||||
|
'data' => $user_data_to_export,
|
||||||
|
);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'data' => $data_to_export,
|
||||||
|
'done' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update log when privacy request is confirmed.
|
* Update log when privacy request is confirmed.
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-43054';
|
$wp_version = '5.0-alpha-43055';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue