Privacy: Add "Mark as completed" action.
Props garrett-eclipse, ocean90, joostdevalk, mista-flo, helen. Fixes #46619. git-svn-id: https://develop.svn.wordpress.org/trunk@49258 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
18c1ab8e89
commit
0d2249cc21
@ -47,25 +47,56 @@ class WP_Privacy_Data_Export_Requests_List_Table extends WP_Privacy_Requests_Tab
|
||||
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||
$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
|
||||
$exporters_count = count( $exporters );
|
||||
$status = $item->status;
|
||||
$request_id = $item->ID;
|
||||
$nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
|
||||
|
||||
$download_data_markup = '<div class="export-personal-data" ' .
|
||||
$download_data_markup = '<span class="export-personal-data" ' .
|
||||
'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
|
||||
'data-request-id="' . esc_attr( $request_id ) . '" ' .
|
||||
'data-nonce="' . esc_attr( $nonce ) .
|
||||
'">';
|
||||
|
||||
$download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
|
||||
'<span class="export-personal-data-processing hidden">' . __( 'Downloading Data...' ) . ' <span class="export-progress"></span></span>' .
|
||||
'<span class="export-personal-data-success hidden"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data Again' ) . '</button></span>' .
|
||||
$download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download personal data' ) . '</button></span>' .
|
||||
'<span class="export-personal-data-processing hidden">' . __( 'Downloading data...' ) . ' <span class="export-progress"></span></span>' .
|
||||
'<span class="export-personal-data-success hidden"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download personal data again' ) . '</button></span>' .
|
||||
'<span class="export-personal-data-failed hidden">' . __( 'Download failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
|
||||
|
||||
$download_data_markup .= '</div>';
|
||||
$download_data_markup .= '</span>';
|
||||
|
||||
$row_actions = array(
|
||||
'download-data' => $download_data_markup,
|
||||
$row_actions['download-data'] = $download_data_markup;
|
||||
|
||||
if ( 'request-completed' !== $status ) {
|
||||
$complete_request_markup = '<span>';
|
||||
$complete_request_markup .= sprintf(
|
||||
'<a href="%s" class="complete-request" aria-label="%s">%s</a>',
|
||||
esc_url(
|
||||
wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'complete',
|
||||
'request_id' => array( $request_id ),
|
||||
),
|
||||
admin_url( 'export-personal-data.php' )
|
||||
),
|
||||
'bulk-privacy_requests'
|
||||
)
|
||||
),
|
||||
esc_attr(
|
||||
sprintf(
|
||||
/* translators: %s: Request email. */
|
||||
__( 'Mark export request for “%s” as completed.' ),
|
||||
$item->email
|
||||
)
|
||||
),
|
||||
__( 'Complete request' )
|
||||
);
|
||||
$complete_request_markup .= '</span>';
|
||||
}
|
||||
|
||||
if ( ! empty ( $complete_request_markup ) ) {
|
||||
$row_actions['complete-request'] = $complete_request_markup;
|
||||
}
|
||||
|
||||
return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) );
|
||||
}
|
||||
@ -99,8 +130,8 @@ class WP_Privacy_Data_Export_Requests_List_Table extends WP_Privacy_Requests_Tab
|
||||
'">';
|
||||
|
||||
?>
|
||||
<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle"><?php _e( 'Send Export Link' ); ?></button></span>
|
||||
<span class="export-personal-data-processing hidden"><?php _e( 'Sending Email...' ); ?> <span class="export-progress"></span></span>
|
||||
<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle"><?php _e( 'Send export link' ); ?></button></span>
|
||||
<span class="export-personal-data-processing hidden"><?php _e( 'Sending email...' ); ?> <span class="export-progress"></span></span>
|
||||
<span class="export-personal-data-success success-message hidden"><?php _e( 'Email sent.' ); ?></span>
|
||||
<span class="export-personal-data-failed hidden"><?php _e( 'Email could not be sent.' ); ?> <button type="button" class="button-link export-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||
<?php
|
||||
|
@ -48,29 +48,60 @@ class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Ta
|
||||
|
||||
// Allow the administrator to "force remove" the personal data even if confirmation has not yet been received.
|
||||
$status = $item->status;
|
||||
$request_id = $item->ID;
|
||||
$row_actions = array();
|
||||
if ( 'request-confirmed' !== $status ) {
|
||||
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||
$erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() );
|
||||
$erasers_count = count( $erasers );
|
||||
$request_id = $item->ID;
|
||||
$nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
|
||||
|
||||
$remove_data_markup = '<div class="remove-personal-data force-remove-personal-data" ' .
|
||||
$remove_data_markup = '<span class="remove-personal-data force-remove-personal-data" ' .
|
||||
'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
|
||||
'data-request-id="' . esc_attr( $request_id ) . '" ' .
|
||||
'data-nonce="' . esc_attr( $nonce ) .
|
||||
'">';
|
||||
|
||||
$remove_data_markup .= '<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle">' . __( 'Force Erase Personal Data' ) . '</button></span>' .
|
||||
'<span class="remove-personal-data-processing hidden">' . __( 'Erasing Data...' ) . ' <span class="erasure-progress"></span></span>' .
|
||||
$remove_data_markup .= '<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle">' . __( 'Force erase personal data' ) . '</button></span>' .
|
||||
'<span class="remove-personal-data-processing hidden">' . __( 'Erasing data...' ) . ' <span class="erasure-progress"></span></span>' .
|
||||
'<span class="remove-personal-data-success hidden">' . __( 'Erasure completed.' ) . '</span>' .
|
||||
'<span class="remove-personal-data-failed hidden">' . __( 'Force Erasure has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
|
||||
'<span class="remove-personal-data-failed hidden">' . __( 'Force erasure has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
|
||||
|
||||
$remove_data_markup .= '</div>';
|
||||
$remove_data_markup .= '</span>';
|
||||
|
||||
$row_actions = array(
|
||||
'remove-data' => $remove_data_markup,
|
||||
$row_actions['remove-data'] = $remove_data_markup;
|
||||
}
|
||||
|
||||
if ( 'request-completed' !== $status ) {
|
||||
$complete_request_markup = '<span>';
|
||||
$complete_request_markup .= sprintf(
|
||||
'<a href="%s" class="complete-request" aria-label="%s">%s</a>',
|
||||
esc_url(
|
||||
wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'complete',
|
||||
'request_id' => array( $request_id ),
|
||||
),
|
||||
admin_url( 'erase-personal-data.php' )
|
||||
),
|
||||
'bulk-privacy_requests'
|
||||
)
|
||||
),
|
||||
esc_attr(
|
||||
sprintf(
|
||||
/* translators: %s: Request email. */
|
||||
__( 'Mark export request for “%s” as completed.' ),
|
||||
$item->email
|
||||
)
|
||||
),
|
||||
__( 'Complete request' )
|
||||
);
|
||||
$complete_request_markup .= '</span>';
|
||||
}
|
||||
|
||||
if ( ! empty ( $complete_request_markup ) ) {
|
||||
$row_actions['complete-request'] = $complete_request_markup;
|
||||
}
|
||||
|
||||
return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) );
|
||||
@ -105,10 +136,10 @@ class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Ta
|
||||
'">';
|
||||
|
||||
?>
|
||||
<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
|
||||
<span class="remove-personal-data-processing hidden"><?php _e( 'Erasing Data...' ); ?> <span class="erasure-progress"></span></span>
|
||||
<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle"><?php _e( 'Erase personal data' ); ?></button></span>
|
||||
<span class="remove-personal-data-processing hidden"><?php _e( 'Erasing data...' ); ?> <span class="erasure-progress"></span></span>
|
||||
<span class="remove-personal-data-success success-message hidden" ><?php _e( 'Erasure completed.' ); ?></span>
|
||||
<span class="remove-personal-data-failed hidden"><?php _e( 'Data Erasure has failed.' ); ?> <button type="button" class="button-link remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||
<span class="remove-personal-data-failed hidden"><?php _e( 'Data erasure has failed.' ); ?> <button type="button" class="button-link remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||
<?php
|
||||
|
||||
echo '</div>';
|
||||
|
@ -43,7 +43,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
'email' => __( 'Requester' ),
|
||||
'status' => __( 'Status' ),
|
||||
'created_timestamp' => __( 'Requested' ),
|
||||
'next_steps' => __( 'Next Steps' ),
|
||||
'next_steps' => __( 'Next steps' ),
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
@ -210,8 +210,9 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
*/
|
||||
protected function get_bulk_actions() {
|
||||
return array(
|
||||
'delete' => __( 'Delete Requests' ),
|
||||
'resend' => __( 'Resend Confirmation Requests' ),
|
||||
'resend' => __( 'Resend confirmation requests' ),
|
||||
'complete' => __( 'Mark requests as completed' ),
|
||||
'delete' => __( 'Delete requests' ),
|
||||
);
|
||||
}
|
||||
|
||||
@ -219,6 +220,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
* Process bulk actions.
|
||||
*
|
||||
* @since 4.9.6
|
||||
* @since 5.6.0 Added support for the `complete` action.
|
||||
*/
|
||||
public function process_bulk_action() {
|
||||
$action = $this->current_action();
|
||||
@ -231,21 +233,6 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
switch ( $action ) {
|
||||
case 'delete':
|
||||
foreach ( $request_ids as $request_id ) {
|
||||
if ( wp_delete_post( $request_id, true ) ) {
|
||||
$count ++;
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_error(
|
||||
'bulk_action',
|
||||
'bulk_action',
|
||||
/* translators: %d: Number of requests. */
|
||||
sprintf( _n( 'Deleted %d request.', 'Deleted %d requests.', $count ), $count ),
|
||||
'success'
|
||||
);
|
||||
break;
|
||||
case 'resend':
|
||||
foreach ( $request_ids as $request_id ) {
|
||||
$resend = _wp_privacy_resend_request( $request_id );
|
||||
@ -263,6 +250,38 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
'success'
|
||||
);
|
||||
break;
|
||||
case 'complete':
|
||||
foreach ( $request_ids as $request_id ) {
|
||||
$result = _wp_privacy_completed_request( $request_id );
|
||||
|
||||
if ( $result && ! is_wp_error( $result ) ) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_error(
|
||||
'bulk_action',
|
||||
'bulk_action',
|
||||
/* translators: %d: Number of requests. */
|
||||
sprintf( _n( '%d request marked as complete.', '%d requests marked as complete.', $count ), $count ),
|
||||
'success'
|
||||
);
|
||||
break;
|
||||
case 'delete':
|
||||
foreach ( $request_ids as $request_id ) {
|
||||
if ( wp_delete_post( $request_id, true ) ) {
|
||||
$count ++;
|
||||
}
|
||||
}
|
||||
|
||||
add_settings_error(
|
||||
'bulk_action',
|
||||
'bulk_action',
|
||||
/* translators: %d: Number of requests. */
|
||||
sprintf( _n( 'Deleted %d request.', 'Deleted %d requests.', $count ), $count ),
|
||||
'success'
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user