wp_get_user_request example

if ( $request_id < 1 ) {
        wp_send_json_error( __( 'Invalid request ID.' ) );
    }

    if ( ! current_user_can( 'export_others_personal_data' ) ) {
        wp_send_json_error( __( 'Sorry, you are not allowed to perform this action.' ) );
    }

    check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' );

    // Get the request.     $request = wp_get_user_request( $request_id );

    if ( ! $request || 'export_personal_data' !== $request->action_name ) {
        wp_send_json_error( __( 'Invalid request type.' ) );
    }

    $email_address = $request->email;
    if ( ! is_email( $email_address ) ) {
        wp_send_json_error( __( 'A valid email address must be given.' ) );
    }

    if ( ! isset( $_POST['exporter'] ) ) {
        

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 );
}

/** * Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes. * * @since 4.4.0 * @deprecated 5.5.0 * * @see wp_image_add_srcset_and_sizes() * * @param string $content The raw post content to be filtered. * @return string Converted content with 'srcset' and 'sizes' attributes added to images. */


/** * Updates log when privacy request is confirmed. * * @since 4.9.6 * @access private * * @param int $request_id ID of the request. */
function _wp_privacy_account_request_confirmed( $request_id ) {
    $request = wp_get_user_request( $request_id );

    if ( ! $request ) {
        return;
    }

    if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) {
        return;
    }

    update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() );
    wp_update_post(
        

function _wp_privacy_completed_request( $request_id ) {
    // Get the request.     $request_id = absint( $request_id );
    $request    = wp_get_user_request( $request_id );

    if ( ! $request ) {
        return new WP_Error( 'privacy_request_error', __( 'Invalid personal data request.' ) );
    }

    update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );

    $result = wp_update_post(
        array(
            'ID'          => $request_id,
            'post_status' => 'request-completed',
        )


        if ( ! empty( $_REQUEST['filter-status'] ) ) {
            $filter_status       = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
            $args['post_status'] = $filter_status;
        }

        $requests_query = new WP_Query( $args );
        $requests       = $requests_query->posts;

        foreach ( $requests as $request ) {
            $this->items[] = wp_get_user_request( $request->ID );
        }

        $this->items = array_filter( $this->items );

        $this->set_pagination_args(
            array(
                'total_items' => $requests_query->found_posts,
                'per_page'    => $posts_per_page,
            )
        );
    }

    
Home | Imprint | This part of the site doesn't use cookies.