WordPress.org

Make WordPress Core

Changeset 44606


Ignore:
Timestamp:
01/15/2019 10:34:39 PM (19 months ago)
Author:
desrosj
Message:

Privacy: Use consistent variable naming when working with privacy requests.

Throughout the core privacy functions, WP_User_Request instances were stored in variables named both $request, and $request_data. This changes all occurrences of $request_data to $request for better consistency.

Props nateallen, bruceallen, garrett-eclipse.
Fixes #44708.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r43665 r44606  
    619619 *
    620620 * @param  int          $request_id Request ID.
    621  * @return int|WP_Error $request    Request ID on success or WP_Error.
     621 * @return int|WP_Error $result Request ID on success or WP_Error.
    622622 */
    623623function _wp_privacy_completed_request( $request_id ) {
    624     $request_id   = absint( $request_id );
    625     $request_data = wp_get_user_request_data( $request_id );
    626 
    627     if ( ! $request_data ) {
     624    $request_id = absint( $request_id );
     625    $request    = wp_get_user_request_data( $request_id );
     626
     627    if ( ! $request ) {
    628628        return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
    629629    }
     
    631631    update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
    632632
    633     $request = wp_update_post(
     633    $result = wp_update_post(
    634634        array(
    635635            'ID'          => $request_id,
     
    638638    );
    639639
    640     return $request;
     640    return $result;
    641641}
    642642
  • trunk/src/wp-includes/user.php

    r44605 r44606  
    29632963 */
    29642964function _wp_privacy_account_request_confirmed( $request_id ) {
    2965     $request_data = wp_get_user_request_data( $request_id );
    2966 
    2967     if ( ! $request_data ) {
     2965    $request = wp_get_user_request_data( $request_id );
     2966
     2967    if ( ! $request ) {
    29682968        return;
    29692969    }
    29702970
    2971     if ( ! in_array( $request_data->status, array( 'request-pending', 'request-failed' ), true ) ) {
     2971    if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) {
    29722972        return;
    29732973    }
     
    29932993 */
    29942994function _wp_privacy_send_request_confirmation_notification( $request_id ) {
    2995     $request_data = wp_get_user_request_data( $request_id );
    2996 
    2997     if ( ! is_a( $request_data, 'WP_User_Request' ) || 'request-confirmed' !== $request_data->status ) {
     2995    $request = wp_get_user_request_data( $request_id );
     2996
     2997    if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
    29982998        return;
    29992999    }
     
    30053005    }
    30063006
    3007     $manage_url         = add_query_arg( 'page', $request_data->action_name, admin_url( 'tools.php' ) );
    3008     $action_description = wp_user_request_action_description( $request_data->action_name );
     3007    $manage_url         = add_query_arg( 'page', $request->action_name, admin_url( 'tools.php' ) );
     3008    $action_description = wp_user_request_action_description( $request->action_name );
    30093009
    30103010    /**
     
    30193019     * @since 4.9.6
    30203020     *
    3021      * @param string          $admin_email  The email address of the notification recipient.
    3022      * @param WP_User_Request $request_data The request that is initiating the notification.
    3023      */
    3024     $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request_data );
     3021     * @param string          $admin_email The email address of the notification recipient.
     3022     * @param WP_User_Request $request    The request that is initiating the notification.
     3023     */
     3024    $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request );
    30253025
    30263026    $email_data = array(
    3027         'request'     => $request_data,
    3028         'user_email'  => $request_data->email,
     3027        'request'     => $request,
     3028        'user_email'  => $request->email,
    30293029        'description' => $action_description,
    30303030        'manage_url'  => $manage_url,
     
    31323132 */
    31333133function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
    3134     $request_data = wp_get_user_request_data( $request_id );
    3135 
    3136     if ( ! is_a( $request_data, 'WP_User_Request' ) || 'request-completed' !== $request_data->status ) {
     3134    $request = wp_get_user_request_data( $request_id );
     3135
     3136    if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
    31373137        return;
    31383138    }
     
    31493149     * @since 4.9.6
    31503150     *
    3151      * @param string          $user_email   The email address of the notification recipient.
    3152      * @param WP_User_Request $request_data The request that is initiating the notification.
    3153      */
    3154     $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request_data->email, $request_data );
     3151     * @param string          $user_email The email address of the notification recipient.
     3152     * @param WP_User_Request $request    The request that is initiating the notification.
     3153     */
     3154    $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request );
    31553155
    31563156    $email_data = array(
    3157         'request'            => $request_data,
     3157        'request'            => $request,
    31583158        'message_recipient'  => $user_email,
    31593159        'privacy_policy_url' => get_privacy_policy_url(),
Note: See TracChangeset for help on using the changeset viewer.