Automattic\WooCommerce\Admin\API

OnboardingTasks::snooze_task_permissions_check()publicWC 1.0

Deprecated from version 7.8.0 snooze task is deprecated.. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Check if a given request has access to manage woocommerce.

Method of the class: OnboardingTasks{}

No Hooks.

Return

WP_Error|true|false.

Usage

$OnboardingTasks = new OnboardingTasks();
$OnboardingTasks->snooze_task_permissions_check( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Changelog

Deprecated since 7.8.0 snooze task is deprecated.

OnboardingTasks::snooze_task_permissions_check() code WC 8.7.0

public function snooze_task_permissions_check( $request ) {
	wc_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '7.8.0' );

	if ( ! current_user_can( 'manage_woocommerce' ) ) {
		return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to snooze onboarding tasks.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
	}

	return true;
}