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. git-svn-id: https://develop.svn.wordpress.org/trunk@47245 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d4475d552c
commit
c0c2fd3f63
@ -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 );
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ class Tests_Privacy_WpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
|||||||
$this->assertTrue( file_exists( $report_dir . 'index.html' ) );
|
$this->assertTrue( file_exists( $report_dir . 'index.html' ) );
|
||||||
|
|
||||||
$report_contents = file_get_contents( $report_dir . 'index.html' );
|
$report_contents = file_get_contents( $report_dir . 'index.html' );
|
||||||
$request = wp_get_user_request_data( self::$export_request_id );
|
$request = wp_get_user_request( self::$export_request_id );
|
||||||
|
|
||||||
$this->assertContains( '<h1>Personal Data Export</h1>', $report_contents );
|
$this->assertContains( '<h1>Personal Data Export</h1>', $report_contents );
|
||||||
$this->assertContains( '<h2>About</h2>', $report_contents );
|
$this->assertContains( '<h2>About</h2>', $report_contents );
|
||||||
@ -285,7 +285,7 @@ class Tests_Privacy_WpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
|
|||||||
$zip->extractTo( $report_dir );
|
$zip->extractTo( $report_dir );
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|
||||||
$request = wp_get_user_request_data( self::$export_request_id );
|
$request = wp_get_user_request( self::$export_request_id );
|
||||||
|
|
||||||
$this->assertTrue( file_exists( $report_dir . 'export.json' ) );
|
$this->assertTrue( file_exists( $report_dir . 'export.json' ) );
|
||||||
|
|
||||||
|
@ -152,16 +152,16 @@ class Tests_User_WpPrivacySendRequestConfirmationNotification extends WP_UnitTes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter callback that modifies the recipient of the data request confirmation notification.
|
* Filter callback that modifies the recipient of the user request confirmation notification.
|
||||||
*
|
*
|
||||||
* @since 4.9.8
|
* @since 4.9.8
|
||||||
*
|
*
|
||||||
* @param string $admin_email The email address of the notification recipient.
|
* @param string $admin_email The email address of the notification recipient.
|
||||||
* @param WP_User_Request $request_data The request that is initiating the notification.
|
* @param WP_User_Request $request The request that is initiating the notification.
|
||||||
* @return string Admin email address.
|
* @return string Admin email address.
|
||||||
*/
|
*/
|
||||||
public function modify_email_address( $admin_email, $request_data ) {
|
public function modify_email_address( $admin_email, $request ) {
|
||||||
$admin_email = $request_data->email;
|
$admin_email = $request->email;
|
||||||
return $admin_email;
|
return $admin_email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user