Edit File by line
/home/barbar84/www/wp-inclu...
File: user.php
*
[3000] Fix | Delete
* @since 4.0.0
[3001] Fix | Delete
*
[3002] Fix | Delete
* @return string Token.
[3003] Fix | Delete
*/
[3004] Fix | Delete
function wp_get_session_token() {
[3005] Fix | Delete
$cookie = wp_parse_auth_cookie( '', 'logged_in' );
[3006] Fix | Delete
return ! empty( $cookie['token'] ) ? $cookie['token'] : '';
[3007] Fix | Delete
}
[3008] Fix | Delete
[3009] Fix | Delete
/**
[3010] Fix | Delete
* Retrieve a list of sessions for the current user.
[3011] Fix | Delete
*
[3012] Fix | Delete
* @since 4.0.0
[3013] Fix | Delete
*
[3014] Fix | Delete
* @return array Array of sessions.
[3015] Fix | Delete
*/
[3016] Fix | Delete
function wp_get_all_sessions() {
[3017] Fix | Delete
$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
[3018] Fix | Delete
return $manager->get_all();
[3019] Fix | Delete
}
[3020] Fix | Delete
[3021] Fix | Delete
/**
[3022] Fix | Delete
* Remove the current session token from the database.
[3023] Fix | Delete
*
[3024] Fix | Delete
* @since 4.0.0
[3025] Fix | Delete
*/
[3026] Fix | Delete
function wp_destroy_current_session() {
[3027] Fix | Delete
$token = wp_get_session_token();
[3028] Fix | Delete
if ( $token ) {
[3029] Fix | Delete
$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
[3030] Fix | Delete
$manager->destroy( $token );
[3031] Fix | Delete
}
[3032] Fix | Delete
}
[3033] Fix | Delete
[3034] Fix | Delete
/**
[3035] Fix | Delete
* Remove all but the current session token for the current user for the database.
[3036] Fix | Delete
*
[3037] Fix | Delete
* @since 4.0.0
[3038] Fix | Delete
*/
[3039] Fix | Delete
function wp_destroy_other_sessions() {
[3040] Fix | Delete
$token = wp_get_session_token();
[3041] Fix | Delete
if ( $token ) {
[3042] Fix | Delete
$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
[3043] Fix | Delete
$manager->destroy_others( $token );
[3044] Fix | Delete
}
[3045] Fix | Delete
}
[3046] Fix | Delete
[3047] Fix | Delete
/**
[3048] Fix | Delete
* Remove all session tokens for the current user from the database.
[3049] Fix | Delete
*
[3050] Fix | Delete
* @since 4.0.0
[3051] Fix | Delete
*/
[3052] Fix | Delete
function wp_destroy_all_sessions() {
[3053] Fix | Delete
$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
[3054] Fix | Delete
$manager->destroy_all();
[3055] Fix | Delete
}
[3056] Fix | Delete
[3057] Fix | Delete
/**
[3058] Fix | Delete
* Get the user IDs of all users with no role on this site.
[3059] Fix | Delete
*
[3060] Fix | Delete
* @since 4.4.0
[3061] Fix | Delete
* @since 4.9.0 The `$site_id` parameter was added to support multisite.
[3062] Fix | Delete
*
[3063] Fix | Delete
* @param int|null $site_id Optional. The site ID to get users with no role for. Defaults to the current site.
[3064] Fix | Delete
* @return string[] Array of user IDs as strings.
[3065] Fix | Delete
*/
[3066] Fix | Delete
function wp_get_users_with_no_role( $site_id = null ) {
[3067] Fix | Delete
global $wpdb;
[3068] Fix | Delete
[3069] Fix | Delete
if ( ! $site_id ) {
[3070] Fix | Delete
$site_id = get_current_blog_id();
[3071] Fix | Delete
}
[3072] Fix | Delete
[3073] Fix | Delete
$prefix = $wpdb->get_blog_prefix( $site_id );
[3074] Fix | Delete
[3075] Fix | Delete
if ( is_multisite() && get_current_blog_id() != $site_id ) {
[3076] Fix | Delete
switch_to_blog( $site_id );
[3077] Fix | Delete
$role_names = wp_roles()->get_names();
[3078] Fix | Delete
restore_current_blog();
[3079] Fix | Delete
} else {
[3080] Fix | Delete
$role_names = wp_roles()->get_names();
[3081] Fix | Delete
}
[3082] Fix | Delete
[3083] Fix | Delete
$regex = implode( '|', array_keys( $role_names ) );
[3084] Fix | Delete
$regex = preg_replace( '/[^a-zA-Z_\|-]/', '', $regex );
[3085] Fix | Delete
$users = $wpdb->get_col(
[3086] Fix | Delete
$wpdb->prepare(
[3087] Fix | Delete
"
[3088] Fix | Delete
SELECT user_id
[3089] Fix | Delete
FROM $wpdb->usermeta
[3090] Fix | Delete
WHERE meta_key = '{$prefix}capabilities'
[3091] Fix | Delete
AND meta_value NOT REGEXP %s
[3092] Fix | Delete
",
[3093] Fix | Delete
$regex
[3094] Fix | Delete
)
[3095] Fix | Delete
);
[3096] Fix | Delete
[3097] Fix | Delete
return $users;
[3098] Fix | Delete
}
[3099] Fix | Delete
[3100] Fix | Delete
/**
[3101] Fix | Delete
* Retrieves the current user object.
[3102] Fix | Delete
*
[3103] Fix | Delete
* Will set the current user, if the current user is not set. The current user
[3104] Fix | Delete
* will be set to the logged-in person. If no user is logged-in, then it will
[3105] Fix | Delete
* set the current user to 0, which is invalid and won't have any permissions.
[3106] Fix | Delete
*
[3107] Fix | Delete
* This function is used by the pluggable functions wp_get_current_user() and
[3108] Fix | Delete
* get_currentuserinfo(), the latter of which is deprecated but used for backward
[3109] Fix | Delete
* compatibility.
[3110] Fix | Delete
*
[3111] Fix | Delete
* @since 4.5.0
[3112] Fix | Delete
* @access private
[3113] Fix | Delete
*
[3114] Fix | Delete
* @see wp_get_current_user()
[3115] Fix | Delete
* @global WP_User $current_user Checks if the current user is set.
[3116] Fix | Delete
*
[3117] Fix | Delete
* @return WP_User Current WP_User instance.
[3118] Fix | Delete
*/
[3119] Fix | Delete
function _wp_get_current_user() {
[3120] Fix | Delete
global $current_user;
[3121] Fix | Delete
[3122] Fix | Delete
if ( ! empty( $current_user ) ) {
[3123] Fix | Delete
if ( $current_user instanceof WP_User ) {
[3124] Fix | Delete
return $current_user;
[3125] Fix | Delete
}
[3126] Fix | Delete
[3127] Fix | Delete
// Upgrade stdClass to WP_User.
[3128] Fix | Delete
if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
[3129] Fix | Delete
$cur_id = $current_user->ID;
[3130] Fix | Delete
$current_user = null;
[3131] Fix | Delete
wp_set_current_user( $cur_id );
[3132] Fix | Delete
return $current_user;
[3133] Fix | Delete
}
[3134] Fix | Delete
[3135] Fix | Delete
// $current_user has a junk value. Force to WP_User with ID 0.
[3136] Fix | Delete
$current_user = null;
[3137] Fix | Delete
wp_set_current_user( 0 );
[3138] Fix | Delete
return $current_user;
[3139] Fix | Delete
}
[3140] Fix | Delete
[3141] Fix | Delete
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
[3142] Fix | Delete
wp_set_current_user( 0 );
[3143] Fix | Delete
return $current_user;
[3144] Fix | Delete
}
[3145] Fix | Delete
[3146] Fix | Delete
/**
[3147] Fix | Delete
* Filters the current user.
[3148] Fix | Delete
*
[3149] Fix | Delete
* The default filters use this to determine the current user from the
[3150] Fix | Delete
* request's cookies, if available.
[3151] Fix | Delete
*
[3152] Fix | Delete
* Returning a value of false will effectively short-circuit setting
[3153] Fix | Delete
* the current user.
[3154] Fix | Delete
*
[3155] Fix | Delete
* @since 3.9.0
[3156] Fix | Delete
*
[3157] Fix | Delete
* @param int|false $user_id User ID if one has been determined, false otherwise.
[3158] Fix | Delete
*/
[3159] Fix | Delete
$user_id = apply_filters( 'determine_current_user', false );
[3160] Fix | Delete
if ( ! $user_id ) {
[3161] Fix | Delete
wp_set_current_user( 0 );
[3162] Fix | Delete
return $current_user;
[3163] Fix | Delete
}
[3164] Fix | Delete
[3165] Fix | Delete
wp_set_current_user( $user_id );
[3166] Fix | Delete
[3167] Fix | Delete
return $current_user;
[3168] Fix | Delete
}
[3169] Fix | Delete
[3170] Fix | Delete
/**
[3171] Fix | Delete
* Send a confirmation request email when a change of user email address is attempted.
[3172] Fix | Delete
*
[3173] Fix | Delete
* @since 3.0.0
[3174] Fix | Delete
* @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
[3175] Fix | Delete
*
[3176] Fix | Delete
* @global WP_Error $errors WP_Error object.
[3177] Fix | Delete
*/
[3178] Fix | Delete
function send_confirmation_on_profile_email() {
[3179] Fix | Delete
global $errors;
[3180] Fix | Delete
[3181] Fix | Delete
$current_user = wp_get_current_user();
[3182] Fix | Delete
if ( ! is_object( $errors ) ) {
[3183] Fix | Delete
$errors = new WP_Error();
[3184] Fix | Delete
}
[3185] Fix | Delete
[3186] Fix | Delete
if ( $current_user->ID != $_POST['user_id'] ) {
[3187] Fix | Delete
return false;
[3188] Fix | Delete
}
[3189] Fix | Delete
[3190] Fix | Delete
if ( $current_user->user_email != $_POST['email'] ) {
[3191] Fix | Delete
if ( ! is_email( $_POST['email'] ) ) {
[3192] Fix | Delete
$errors->add(
[3193] Fix | Delete
'user_email',
[3194] Fix | Delete
__( '<strong>Error</strong>: The email address isn&#8217;t correct.' ),
[3195] Fix | Delete
array(
[3196] Fix | Delete
'form-field' => 'email',
[3197] Fix | Delete
)
[3198] Fix | Delete
);
[3199] Fix | Delete
[3200] Fix | Delete
return;
[3201] Fix | Delete
}
[3202] Fix | Delete
[3203] Fix | Delete
if ( email_exists( $_POST['email'] ) ) {
[3204] Fix | Delete
$errors->add(
[3205] Fix | Delete
'user_email',
[3206] Fix | Delete
__( '<strong>Error</strong>: The email address is already used.' ),
[3207] Fix | Delete
array(
[3208] Fix | Delete
'form-field' => 'email',
[3209] Fix | Delete
)
[3210] Fix | Delete
);
[3211] Fix | Delete
delete_user_meta( $current_user->ID, '_new_email' );
[3212] Fix | Delete
[3213] Fix | Delete
return;
[3214] Fix | Delete
}
[3215] Fix | Delete
[3216] Fix | Delete
$hash = md5( $_POST['email'] . time() . wp_rand() );
[3217] Fix | Delete
$new_user_email = array(
[3218] Fix | Delete
'hash' => $hash,
[3219] Fix | Delete
'newemail' => $_POST['email'],
[3220] Fix | Delete
);
[3221] Fix | Delete
update_user_meta( $current_user->ID, '_new_email', $new_user_email );
[3222] Fix | Delete
[3223] Fix | Delete
$sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
[3224] Fix | Delete
[3225] Fix | Delete
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
[3226] Fix | Delete
$email_text = __(
[3227] Fix | Delete
'Howdy ###USERNAME###,
[3228] Fix | Delete
[3229] Fix | Delete
You recently requested to have the email address on your account changed.
[3230] Fix | Delete
[3231] Fix | Delete
If this is correct, please click on the following link to change it:
[3232] Fix | Delete
###ADMIN_URL###
[3233] Fix | Delete
[3234] Fix | Delete
You can safely ignore and delete this email if you do not want to
[3235] Fix | Delete
take this action.
[3236] Fix | Delete
[3237] Fix | Delete
This email has been sent to ###EMAIL###
[3238] Fix | Delete
[3239] Fix | Delete
Regards,
[3240] Fix | Delete
All at ###SITENAME###
[3241] Fix | Delete
###SITEURL###'
[3242] Fix | Delete
);
[3243] Fix | Delete
[3244] Fix | Delete
/**
[3245] Fix | Delete
* Filters the text of the email sent when a change of user email address is attempted.
[3246] Fix | Delete
*
[3247] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[3248] Fix | Delete
* - ###USERNAME### The current user's username.
[3249] Fix | Delete
* - ###ADMIN_URL### The link to click on to confirm the email change.
[3250] Fix | Delete
* - ###EMAIL### The new email.
[3251] Fix | Delete
* - ###SITENAME### The name of the site.
[3252] Fix | Delete
* - ###SITEURL### The URL to the site.
[3253] Fix | Delete
*
[3254] Fix | Delete
* @since MU (3.0.0)
[3255] Fix | Delete
* @since 4.9.0 This filter is no longer Multisite specific.
[3256] Fix | Delete
*
[3257] Fix | Delete
* @param string $email_text Text in the email.
[3258] Fix | Delete
* @param array $new_user_email {
[3259] Fix | Delete
* Data relating to the new user email address.
[3260] Fix | Delete
*
[3261] Fix | Delete
* @type string $hash The secure hash used in the confirmation link URL.
[3262] Fix | Delete
* @type string $newemail The proposed new email address.
[3263] Fix | Delete
* }
[3264] Fix | Delete
*/
[3265] Fix | Delete
$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
[3266] Fix | Delete
[3267] Fix | Delete
$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
[3268] Fix | Delete
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail=' . $hash ) ), $content );
[3269] Fix | Delete
$content = str_replace( '###EMAIL###', $_POST['email'], $content );
[3270] Fix | Delete
$content = str_replace( '###SITENAME###', $sitename, $content );
[3271] Fix | Delete
$content = str_replace( '###SITEURL###', home_url(), $content );
[3272] Fix | Delete
[3273] Fix | Delete
/* translators: New email address notification email subject. %s: Site title. */
[3274] Fix | Delete
wp_mail( $_POST['email'], sprintf( __( '[%s] Email Change Request' ), $sitename ), $content );
[3275] Fix | Delete
[3276] Fix | Delete
$_POST['email'] = $current_user->user_email;
[3277] Fix | Delete
}
[3278] Fix | Delete
}
[3279] Fix | Delete
[3280] Fix | Delete
/**
[3281] Fix | Delete
* Adds an admin notice alerting the user to check for confirmation request email
[3282] Fix | Delete
* after email address change.
[3283] Fix | Delete
*
[3284] Fix | Delete
* @since 3.0.0
[3285] Fix | Delete
* @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
[3286] Fix | Delete
*
[3287] Fix | Delete
* @global string $pagenow
[3288] Fix | Delete
*/
[3289] Fix | Delete
function new_user_email_admin_notice() {
[3290] Fix | Delete
global $pagenow;
[3291] Fix | Delete
[3292] Fix | Delete
if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) ) {
[3293] Fix | Delete
$email = get_user_meta( get_current_user_id(), '_new_email', true );
[3294] Fix | Delete
if ( $email ) {
[3295] Fix | Delete
/* translators: %s: New email address. */
[3296] Fix | Delete
echo '<div class="notice notice-info"><p>' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '<code>' . esc_html( $email['newemail'] ) . '</code>' ) . '</p></div>';
[3297] Fix | Delete
}
[3298] Fix | Delete
}
[3299] Fix | Delete
}
[3300] Fix | Delete
[3301] Fix | Delete
/**
[3302] Fix | Delete
* Get all personal data request types.
[3303] Fix | Delete
*
[3304] Fix | Delete
* @since 4.9.6
[3305] Fix | Delete
* @access private
[3306] Fix | Delete
*
[3307] Fix | Delete
* @return array List of core privacy action types.
[3308] Fix | Delete
*/
[3309] Fix | Delete
function _wp_privacy_action_request_types() {
[3310] Fix | Delete
return array(
[3311] Fix | Delete
'export_personal_data',
[3312] Fix | Delete
'remove_personal_data',
[3313] Fix | Delete
);
[3314] Fix | Delete
}
[3315] Fix | Delete
[3316] Fix | Delete
/**
[3317] Fix | Delete
* Registers the personal data exporter for users.
[3318] Fix | Delete
*
[3319] Fix | Delete
* @since 4.9.6
[3320] Fix | Delete
*
[3321] Fix | Delete
* @param array $exporters An array of personal data exporters.
[3322] Fix | Delete
* @return array An array of personal data exporters.
[3323] Fix | Delete
*/
[3324] Fix | Delete
function wp_register_user_personal_data_exporter( $exporters ) {
[3325] Fix | Delete
$exporters['wordpress-user'] = array(
[3326] Fix | Delete
'exporter_friendly_name' => __( 'WordPress User' ),
[3327] Fix | Delete
'callback' => 'wp_user_personal_data_exporter',
[3328] Fix | Delete
);
[3329] Fix | Delete
[3330] Fix | Delete
return $exporters;
[3331] Fix | Delete
}
[3332] Fix | Delete
[3333] Fix | Delete
/**
[3334] Fix | Delete
* Finds and exports personal data associated with an email address from the user and user_meta table.
[3335] Fix | Delete
*
[3336] Fix | Delete
* @since 4.9.6
[3337] Fix | Delete
* @since 5.4.0 Added 'Community Events Location' group to the export data.
[3338] Fix | Delete
* @since 5.4.0 Added 'Session Tokens' group to the export data.
[3339] Fix | Delete
*
[3340] Fix | Delete
* @param string $email_address The user's email address.
[3341] Fix | Delete
* @return array An array of personal data.
[3342] Fix | Delete
*/
[3343] Fix | Delete
function wp_user_personal_data_exporter( $email_address ) {
[3344] Fix | Delete
$email_address = trim( $email_address );
[3345] Fix | Delete
[3346] Fix | Delete
$data_to_export = array();
[3347] Fix | Delete
[3348] Fix | Delete
$user = get_user_by( 'email', $email_address );
[3349] Fix | Delete
[3350] Fix | Delete
if ( ! $user ) {
[3351] Fix | Delete
return array(
[3352] Fix | Delete
'data' => array(),
[3353] Fix | Delete
'done' => true,
[3354] Fix | Delete
);
[3355] Fix | Delete
}
[3356] Fix | Delete
[3357] Fix | Delete
$user_meta = get_user_meta( $user->ID );
[3358] Fix | Delete
[3359] Fix | Delete
$user_props_to_export = array(
[3360] Fix | Delete
'ID' => __( 'User ID' ),
[3361] Fix | Delete
'user_login' => __( 'User Login Name' ),
[3362] Fix | Delete
'user_nicename' => __( 'User Nice Name' ),
[3363] Fix | Delete
'user_email' => __( 'User Email' ),
[3364] Fix | Delete
'user_url' => __( 'User URL' ),
[3365] Fix | Delete
'user_registered' => __( 'User Registration Date' ),
[3366] Fix | Delete
'display_name' => __( 'User Display Name' ),
[3367] Fix | Delete
'nickname' => __( 'User Nickname' ),
[3368] Fix | Delete
'first_name' => __( 'User First Name' ),
[3369] Fix | Delete
'last_name' => __( 'User Last Name' ),
[3370] Fix | Delete
'description' => __( 'User Description' ),
[3371] Fix | Delete
);
[3372] Fix | Delete
[3373] Fix | Delete
$user_data_to_export = array();
[3374] Fix | Delete
[3375] Fix | Delete
foreach ( $user_props_to_export as $key => $name ) {
[3376] Fix | Delete
$value = '';
[3377] Fix | Delete
[3378] Fix | Delete
switch ( $key ) {
[3379] Fix | Delete
case 'ID':
[3380] Fix | Delete
case 'user_login':
[3381] Fix | Delete
case 'user_nicename':
[3382] Fix | Delete
case 'user_email':
[3383] Fix | Delete
case 'user_url':
[3384] Fix | Delete
case 'user_registered':
[3385] Fix | Delete
case 'display_name':
[3386] Fix | Delete
$value = $user->data->$key;
[3387] Fix | Delete
break;
[3388] Fix | Delete
case 'nickname':
[3389] Fix | Delete
case 'first_name':
[3390] Fix | Delete
case 'last_name':
[3391] Fix | Delete
case 'description':
[3392] Fix | Delete
$value = $user_meta[ $key ][0];
[3393] Fix | Delete
break;
[3394] Fix | Delete
}
[3395] Fix | Delete
[3396] Fix | Delete
if ( ! empty( $value ) ) {
[3397] Fix | Delete
$user_data_to_export[] = array(
[3398] Fix | Delete
'name' => $name,
[3399] Fix | Delete
'value' => $value,
[3400] Fix | Delete
);
[3401] Fix | Delete
}
[3402] Fix | Delete
}
[3403] Fix | Delete
[3404] Fix | Delete
// Get the list of reserved names.
[3405] Fix | Delete
$reserved_names = array_values( $user_props_to_export );
[3406] Fix | Delete
[3407] Fix | Delete
/**
[3408] Fix | Delete
* Filter to extend the user's profile data for the privacy exporter.
[3409] Fix | Delete
*
[3410] Fix | Delete
* @since 5.4.0
[3411] Fix | Delete
*
[3412] Fix | Delete
* @param array $additional_user_profile_data {
[3413] Fix | Delete
* An array of name-value pairs of additional user data items. Default empty array.
[3414] Fix | Delete
*
[3415] Fix | Delete
* @type string $name The user-facing name of an item name-value pair,e.g. 'IP Address'.
[3416] Fix | Delete
* @type string $value The user-facing value of an item data pair, e.g. '50.60.70.0'.
[3417] Fix | Delete
* }
[3418] Fix | Delete
* @param WP_User $user The user whose data is being exported.
[3419] Fix | Delete
* @param string[] $reserved_names An array of reserved names. Any item in `$additional_user_data`
[3420] Fix | Delete
* that uses one of these for its `name` will not be included in the export.
[3421] Fix | Delete
*/
[3422] Fix | Delete
$_extra_data = apply_filters( 'wp_privacy_additional_user_profile_data', array(), $user, $reserved_names );
[3423] Fix | Delete
[3424] Fix | Delete
if ( is_array( $_extra_data ) && ! empty( $_extra_data ) ) {
[3425] Fix | Delete
// Remove items that use reserved names.
[3426] Fix | Delete
$extra_data = array_filter(
[3427] Fix | Delete
$_extra_data,
[3428] Fix | Delete
function( $item ) use ( $reserved_names ) {
[3429] Fix | Delete
return ! in_array( $item['name'], $reserved_names, true );
[3430] Fix | Delete
}
[3431] Fix | Delete
);
[3432] Fix | Delete
[3433] Fix | Delete
if ( count( $extra_data ) !== count( $_extra_data ) ) {
[3434] Fix | Delete
_doing_it_wrong(
[3435] Fix | Delete
__FUNCTION__,
[3436] Fix | Delete
sprintf(
[3437] Fix | Delete
/* translators: %s: wp_privacy_additional_user_profile_data */
[3438] Fix | Delete
__( 'Filter %s returned items with reserved names.' ),
[3439] Fix | Delete
'<code>wp_privacy_additional_user_profile_data</code>'
[3440] Fix | Delete
),
[3441] Fix | Delete
'5.4.0'
[3442] Fix | Delete
);
[3443] Fix | Delete
}
[3444] Fix | Delete
[3445] Fix | Delete
if ( ! empty( $extra_data ) ) {
[3446] Fix | Delete
$user_data_to_export = array_merge( $user_data_to_export, $extra_data );
[3447] Fix | Delete
}
[3448] Fix | Delete
}
[3449] Fix | Delete
[3450] Fix | Delete
$data_to_export[] = array(
[3451] Fix | Delete
'group_id' => 'user',
[3452] Fix | Delete
'group_label' => __( 'User' ),
[3453] Fix | Delete
'group_description' => __( 'User&#8217;s profile data.' ),
[3454] Fix | Delete
'item_id' => "user-{$user->ID}",
[3455] Fix | Delete
'data' => $user_data_to_export,
[3456] Fix | Delete
);
[3457] Fix | Delete
[3458] Fix | Delete
if ( isset( $user_meta['community-events-location'] ) ) {
[3459] Fix | Delete
$location = maybe_unserialize( $user_meta['community-events-location'][0] );
[3460] Fix | Delete
[3461] Fix | Delete
$location_props_to_export = array(
[3462] Fix | Delete
'description' => __( 'City' ),
[3463] Fix | Delete
'country' => __( 'Country' ),
[3464] Fix | Delete
'latitude' => __( 'Latitude' ),
[3465] Fix | Delete
'longitude' => __( 'Longitude' ),
[3466] Fix | Delete
'ip' => __( 'IP' ),
[3467] Fix | Delete
);
[3468] Fix | Delete
[3469] Fix | Delete
$location_data_to_export = array();
[3470] Fix | Delete
[3471] Fix | Delete
foreach ( $location_props_to_export as $key => $name ) {
[3472] Fix | Delete
if ( ! empty( $location[ $key ] ) ) {
[3473] Fix | Delete
$location_data_to_export[] = array(
[3474] Fix | Delete
'name' => $name,
[3475] Fix | Delete
'value' => $location[ $key ],
[3476] Fix | Delete
);
[3477] Fix | Delete
}
[3478] Fix | Delete
}
[3479] Fix | Delete
[3480] Fix | Delete
$data_to_export[] = array(
[3481] Fix | Delete
'group_id' => 'community-events-location',
[3482] Fix | Delete
'group_label' => __( 'Community Events Location' ),
[3483] Fix | Delete
'group_description' => __( 'User&#8217;s location data used for the Community Events in the WordPress Events and News dashboard widget.' ),
[3484] Fix | Delete
'item_id' => "community-events-location-{$user->ID}",
[3485] Fix | Delete
'data' => $location_data_to_export,
[3486] Fix | Delete
);
[3487] Fix | Delete
}
[3488] Fix | Delete
[3489] Fix | Delete
if ( isset( $user_meta['session_tokens'] ) ) {
[3490] Fix | Delete
$session_tokens = maybe_unserialize( $user_meta['session_tokens'][0] );
[3491] Fix | Delete
[3492] Fix | Delete
$session_tokens_props_to_export = array(
[3493] Fix | Delete
'expiration' => __( 'Expiration' ),
[3494] Fix | Delete
'ip' => __( 'IP' ),
[3495] Fix | Delete
'ua' => __( 'User Agent' ),
[3496] Fix | Delete
'login' => __( 'Last Login' ),
[3497] Fix | Delete
);
[3498] Fix | Delete
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function