WP_Privacy_Requests_Table::process_bulk_action() – Process bulk actions.

You appear to be a bot. Output may be restricted

Description

Process bulk actions.

Usage

WP_Privacy_Requests_Table::process_bulk_action();

Parameters

Returns

void

Source

File name: wordpress/wp-admin/includes/class-wp-privacy-requests-table.php
Lines:

1 to 100 of 132
  public function process_bulk_action() {
    $action      = $this->current_action();
    $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array();

    if ( empty( $request_ids ) ) {
      return;
    }

    $count    = 0;
    $failures = 0;

    check_admin_referer( 'bulk-privacy_requests' );

    switch ( $action ) {
      case 'resend':
        foreach ( $request_ids as $request_id ) {
          $resend = _wp_privacy_resend_request( $request_id );

          if ( $resend && ! is_wp_error( $resend ) ) {
            $count++;
          } else {
            $failures++;
          }
        }

        if ( $failures ) {
          add_settings_error(
            'bulk_action',
            'bulk_action',
            sprintf(
              /* translators: %d: Number of requests. */
              _n(
                '%d confirmation request failed to resend.',
                '%d confirmation requests failed to resend.',
                $failures
              ),
              $failures
            ),
            'error'
          );
        }

        if ( $count ) {
          add_settings_error(
            'bulk_action',
            'bulk_action',
            sprintf(
              /* translators: %d: Number of requests. */
              _n(
                '%d confirmation request re-sent successfully.',
                '%d confirmation requests re-sent successfully.',
                $count
              ),
              $count
            ),
            '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',
          sprintf(
            /* translators: %d: Number of requests. */
            _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++;
          } else {
            $failures++;
          }
        }

        if ( $failures ) {
          add_settings_error(
            'bulk_action',
            'bulk_action',
            sprintf(
 

 View on GitHub View on Trac