Privacy: Rename `wp_get_user_request_data()` to `wp_get_user_request()` for clarity; deprecate the old function.
The function returns an instance of the `WP_User_Request` object itself, not its `$request_data` property. Follow-up to [44606]. Props garrett-eclipse. Fixes #46302. Built from https://develop.svn.wordpress.org/trunk@47245 git-svn-id: http://core.svn.wordpress.org/trunk@47045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
99f402dc62
commit
3342aafe5e
|
@ -4710,8 +4710,8 @@ function wp_ajax_wp_privacy_export_personal_data() {
|
||||||
|
|
||||||
check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );
|
check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );
|
||||||
|
|
||||||
// Get the request data.
|
// Get the request.
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
||||||
wp_send_json_error( __( 'Invalid request type.' ) );
|
wp_send_json_error( __( 'Invalid request type.' ) );
|
||||||
|
@ -4901,8 +4901,8 @@ function wp_ajax_wp_privacy_erase_personal_data() {
|
||||||
|
|
||||||
check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' );
|
check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' );
|
||||||
|
|
||||||
// Get the request data.
|
// Get the request.
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
|
if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
|
||||||
wp_send_json_error( __( 'Invalid request type.' ) );
|
wp_send_json_error( __( 'Invalid request type.' ) );
|
||||||
|
|
|
@ -302,7 +302,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||||
$requests = $requests_query->posts;
|
$requests = $requests_query->posts;
|
||||||
|
|
||||||
foreach ( $requests as $request ) {
|
foreach ( $requests as $request ) {
|
||||||
$this->items[] = wp_get_user_request_data( $request->ID );
|
$this->items[] = wp_get_user_request( $request->ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->items = array_filter( $this->items );
|
$this->items = array_filter( $this->items );
|
||||||
|
|
|
@ -1564,3 +1564,18 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Req
|
||||||
function _wp_privacy_requests_screen_options() {
|
function _wp_privacy_requests_screen_options() {
|
||||||
_deprecated_function( __FUNCTION__, '5.3.0' );
|
_deprecated_function( __FUNCTION__, '5.3.0' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the user request object for the specified request ID.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @deprecated 5.4.0 Use wp_get_user_request()
|
||||||
|
* @see wp_get_user_request()
|
||||||
|
*
|
||||||
|
* @param int $request_id The ID of the user request.
|
||||||
|
* @return WP_User_Request|false
|
||||||
|
*/
|
||||||
|
function wp_get_user_request_data( $request_id ) {
|
||||||
|
_deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' );
|
||||||
|
return wp_get_user_request( $request_id );
|
||||||
|
}
|
|
@ -41,11 +41,12 @@ function _wp_privacy_resend_request( $request_id ) {
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param int $request_id Request ID.
|
* @param int $request_id Request ID.
|
||||||
* @return int|WP_Error $result Request ID on success or WP_Error.
|
* @return int|WP_Error $result Request ID on success or WP_Error.
|
||||||
*/
|
*/
|
||||||
function _wp_privacy_completed_request( $request_id ) {
|
function _wp_privacy_completed_request( $request_id ) {
|
||||||
|
// Get the request.
|
||||||
$request_id = absint( $request_id );
|
$request_id = absint( $request_id );
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request ) {
|
if ( ! $request ) {
|
||||||
return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
|
return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
|
||||||
|
@ -288,8 +289,8 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
|
||||||
wp_send_json_error( __( 'Unable to generate export file. ZipArchive not available.' ) );
|
wp_send_json_error( __( 'Unable to generate export file. ZipArchive not available.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the request data.
|
// Get the request.
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
||||||
wp_send_json_error( __( 'Invalid request ID when generating export file.' ) );
|
wp_send_json_error( __( 'Invalid request ID when generating export file.' ) );
|
||||||
|
@ -501,8 +502,8 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
|
||||||
* @return true|WP_Error True on success or `WP_Error` on failure.
|
* @return true|WP_Error True on success or `WP_Error` on failure.
|
||||||
*/
|
*/
|
||||||
function wp_privacy_send_personal_data_export_email( $request_id ) {
|
function wp_privacy_send_personal_data_export_email( $request_id ) {
|
||||||
// Get the request data.
|
// Get the request.
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
||||||
return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) );
|
return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) );
|
||||||
|
@ -671,8 +672,8 @@ function wp_privacy_process_personal_data_export_page( $response, $exporter_inde
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the request data.
|
// Get the request.
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
|
||||||
wp_send_json_error( __( 'Invalid request ID when merging exporter data.' ) );
|
wp_send_json_error( __( 'Invalid request ID when merging exporter data.' ) );
|
||||||
|
@ -815,7 +816,8 @@ function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = wp_get_user_request_data( $request_id );
|
// Get the request.
|
||||||
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
|
if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
|
||||||
wp_send_json_error( __( 'Invalid request ID when processing eraser data.' ) );
|
wp_send_json_error( __( 'Invalid request ID when processing eraser data.' ) );
|
||||||
|
|
|
@ -3096,7 +3096,7 @@ function wp_user_personal_data_exporter( $email_address ) {
|
||||||
* @param int $request_id ID of the request.
|
* @param int $request_id ID of the request.
|
||||||
*/
|
*/
|
||||||
function _wp_privacy_account_request_confirmed( $request_id ) {
|
function _wp_privacy_account_request_confirmed( $request_id ) {
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request ) {
|
if ( ! $request ) {
|
||||||
return;
|
return;
|
||||||
|
@ -3126,7 +3126,7 @@ function _wp_privacy_account_request_confirmed( $request_id ) {
|
||||||
* @param int $request_id The ID of the request.
|
* @param int $request_id The ID of the request.
|
||||||
*/
|
*/
|
||||||
function _wp_privacy_send_request_confirmation_notification( $request_id ) {
|
function _wp_privacy_send_request_confirmation_notification( $request_id ) {
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
|
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
|
||||||
return;
|
return;
|
||||||
|
@ -3265,7 +3265,7 @@ All at ###SITENAME###
|
||||||
* @param int $request_id The privacy request post ID associated with this request.
|
* @param int $request_id The privacy request post ID associated with this request.
|
||||||
*/
|
*/
|
||||||
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
|
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
|
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
|
||||||
return;
|
return;
|
||||||
|
@ -3415,7 +3415,7 @@ All at ###SITENAME###
|
||||||
* @return string $message The confirmation message.
|
* @return string $message The confirmation message.
|
||||||
*/
|
*/
|
||||||
function _wp_privacy_account_request_confirmed_message( $request_id ) {
|
function _wp_privacy_account_request_confirmed_message( $request_id ) {
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
$message = '<p class="success">' . __( 'Action has been confirmed.' ) . '</p>';
|
$message = '<p class="success">' . __( 'Action has been confirmed.' ) . '</p>';
|
||||||
$message .= '<p>' . __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ) . '</p>';
|
$message .= '<p>' . __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ) . '</p>';
|
||||||
|
@ -3551,7 +3551,7 @@ function wp_user_request_action_description( $action_name ) {
|
||||||
*/
|
*/
|
||||||
function wp_send_user_request( $request_id ) {
|
function wp_send_user_request( $request_id ) {
|
||||||
$request_id = absint( $request_id );
|
$request_id = absint( $request_id );
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request ) {
|
if ( ! $request ) {
|
||||||
return new WP_Error( 'invalid_request', __( 'Invalid user request.' ) );
|
return new WP_Error( 'invalid_request', __( 'Invalid user request.' ) );
|
||||||
|
@ -3713,7 +3713,7 @@ function wp_validate_user_request_key( $request_id, $key ) {
|
||||||
global $wp_hasher;
|
global $wp_hasher;
|
||||||
|
|
||||||
$request_id = absint( $request_id );
|
$request_id = absint( $request_id );
|
||||||
$request = wp_get_user_request_data( $request_id );
|
$request = wp_get_user_request( $request_id );
|
||||||
|
|
||||||
if ( ! $request ) {
|
if ( ! $request ) {
|
||||||
return new WP_Error( 'invalid_request', __( 'Invalid request.' ) );
|
return new WP_Error( 'invalid_request', __( 'Invalid request.' ) );
|
||||||
|
@ -3765,14 +3765,14 @@ function wp_validate_user_request_key( $request_id, $key ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return data about a user request.
|
* Return the user request object for the specified request ID.
|
||||||
*
|
*
|
||||||
* @since 4.9.6
|
* @since 4.9.6
|
||||||
*
|
*
|
||||||
* @param int $request_id Request ID to get data about.
|
* @param int $request_id The ID of the user request.
|
||||||
* @return WP_User_Request|false
|
* @return WP_User_Request|false
|
||||||
*/
|
*/
|
||||||
function wp_get_user_request_data( $request_id ) {
|
function wp_get_user_request( $request_id ) {
|
||||||
$request_id = absint( $request_id );
|
$request_id = absint( $request_id );
|
||||||
$post = get_post( $request_id );
|
$post = get_post( $request_id );
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.4-alpha-47244';
|
$wp_version = '5.4-alpha-47245';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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