WC_API_Reports::validate_request( null $id = null, null $type = null, null $context = null )

Verify that the current user has permission to view reports


Description Description

See also See also


Top ↑

Parameters Parameters

$id

(Optional) unused

Default value: null

$type

(Optional) unused

Default value: null

$context

(Optional) unused

Default value: null


Top ↑

Return Return

(bool|WP_Error)


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-reports.php

	protected function validate_request( $id = null, $type = null, $context = null ) {

		if ( ! current_user_can( 'view_woocommerce_reports' ) ) {

			return new WP_Error( 'woocommerce_api_user_cannot_read_report', __( 'You do not have permission to read this report', 'woocommerce' ), array( 'status' => 401 ) );

		} else {

			return true;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.