WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/04/2020 03:21:38 AM (9 months ago)
Author:
SergeyBiryukov
Message:

Privacy: Improve clarity of privacy error strings.

Primarily this adds "user privacy" to the strings for privacy requests, so they are more easily distinguished from other system actions within logs.

Props garrett-eclipse, carike, birgire.
Fixes #51351.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r49036 r49090  
    36133613
    36143614    if ( $requests_query->found_posts ) {
    3615         return new WP_Error( 'duplicate_request', __( 'An incomplete request for this email address already exists.' ) );
     3615        return new WP_Error( 'duplicate_request', __( 'An incomplete user privacy request for this email address already exists.' ) );
    36163616    }
    36173617
     
    36813681
    36823682    if ( ! $request ) {
    3683         return new WP_Error( 'invalid_request', __( 'Invalid user request.' ) );
     3683        return new WP_Error( 'invalid_request', __( 'Invalid user privacy request.' ) );
    36843684    }
    36853685
     
    38633863    global $wp_hasher;
    38643864
    3865     $request_id = absint( $request_id );
    3866     $request    = wp_get_user_request( $request_id );
    3867 
    3868     if ( ! $request ) {
    3869         return new WP_Error( 'invalid_request', __( 'Invalid request.' ) );
     3865    $request_id       = absint( $request_id );
     3866    $request          = wp_get_user_request( $request_id );
     3867    $saved_key        = $request->confirm_key;
     3868    $key_request_time = $request->modified_timestamp;
     3869
     3870    if ( ! $request || ! $saved_key || ! $key_request_time ) {
     3871        return new WP_Error( 'invalid_request', __( 'Invalid user privacy request.' ) );
    38703872    }
    38713873
    38723874    if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) {
    3873         return new WP_Error( 'expired_link', __( 'This link has expired.' ) );
     3875        return new WP_Error( 'expired_request', __( 'This user privacy request has expired.' ) );
    38743876    }
    38753877
    38763878    if ( empty( $key ) ) {
    3877         return new WP_Error( 'missing_key', __( 'Missing confirm key.' ) );
     3879        return new WP_Error( 'missing_key', __( 'This user privacy request is missing the confirmation key.' ) );
    38783880    }
    38793881
     
    38833885    }
    38843886
    3885     $key_request_time = $request->modified_timestamp;
    3886     $saved_key        = $request->confirm_key;
    3887 
    3888     if ( ! $saved_key ) {
    3889         return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
    3890     }
    3891 
    3892     if ( ! $key_request_time ) {
    3893         return new WP_Error( 'invalid_key', __( 'Invalid action.' ) );
    3894     }
    3895 
    38963887    /**
    38973888     * Filters the expiration time of confirm keys.
     
    39053896
    39063897    if ( ! $wp_hasher->CheckPassword( $key, $saved_key ) ) {
    3907         return new WP_Error( 'invalid_key', __( 'Invalid key.' ) );
     3898        return new WP_Error( 'invalid_key', __( 'This user privacy request confirmation key is invalid.' ) );
    39083899    }
    39093900
    39103901    if ( ! $expiration_time || time() > $expiration_time ) {
    3911         return new WP_Error( 'expired_key', __( 'The confirmation email has expired.' ) );
     3902        return new WP_Error( 'expired_key', __( 'This user privacy request confirmation key has expired.' ) );
    39123903    }
    39133904
Note: See TracChangeset for help on using the changeset viewer.