Automattic\WooCommerce\Admin\API

OnboardingTasks::snooze_task_permissions_checkpublicWC 1.0

Deprecated since 7.8.0 snooze task is deprecated.. It is no longer supported and may 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.

Returns

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 10.5.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;
}