Privacy: Include `community-events-location` user meta value in Personal Data Export.

The value is used by the WordPress Events and News widget to show relevant WP community events.

The location information may include an IP address, location description, and latitude/longitude coordinates.

Props garrett-eclipse, coreymckrill, xkon.
Fixes #43921.
Built from https://develop.svn.wordpress.org/trunk@47236


git-svn-id: http://core.svn.wordpress.org/trunk@47036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-10 05:32:06 +00:00
parent d98fe66044
commit 346f505a75
2 changed files with 39 additions and 3 deletions

View File

@ -2959,7 +2959,7 @@ function wp_user_personal_data_exporter( $email_address ) {
$user_meta = get_user_meta( $user->ID );
$user_prop_to_export = array(
$user_props_to_export = array(
'ID' => __( 'User ID' ),
'user_login' => __( 'User Login Name' ),
'user_nicename' => __( 'User Nice Name' ),
@ -2975,7 +2975,7 @@ function wp_user_personal_data_exporter( $email_address ) {
$user_data_to_export = array();
foreach ( $user_prop_to_export as $key => $name ) {
foreach ( $user_props_to_export as $key => $name ) {
$value = '';
switch ( $key ) {
@ -3012,6 +3012,42 @@ function wp_user_personal_data_exporter( $email_address ) {
'data' => $user_data_to_export,
);
/**
* Introduce any Community Events Location data that is available.
*
* @since 5.4.0
*/
if ( isset( $user_meta['community-events-location'] ) ) {
$location = maybe_unserialize( $user_meta['community-events-location'][0] );
$location_props_to_export = array(
'description' => __( 'City' ),
'country' => __( 'Country' ),
'latitude' => __( 'Latitude' ),
'longitude' => __( 'Longitude' ),
'ip' => __( 'IP' ),
);
$location_data_to_export = array();
foreach ( $location_props_to_export as $key => $name ) {
if ( ! empty( $location[ $key ] ) ) {
$location_data_to_export[] = array(
'name' => $name,
'value' => $location[ $key ],
);
}
}
$data_to_export[] = array(
'group_id' => 'community-events-location',
'group_label' => __( 'Community Events Location' ),
'group_description' => __( 'User’s location data used for the Community Events in the WordPress Events and News dashboard widget.' ),
'item_id' => "community-events-location-{$user->ID}",
'data' => $location_data_to_export,
);
}
return array(
'data' => $data_to_export,
'done' => true,

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47235';
$wp_version = '5.4-alpha-47236';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.