Automattic\WooCommerce\Internal\Admin\Orders

PageController::verify_edit_permission()privateWC 1.0

Verify that user has permission to edit orders.

Метод класса: PageController{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->verify_edit_permission();

Code of PageController::verify_edit_permission() WC 7.1.0

private function verify_edit_permission() {
	if ( 'edit_order' === $this->current_action && ( ! isset( $this->order ) || ! $this->order ) ) {
		wp_die( esc_html__( 'You attempted to edit an order that does not exist. Perhaps it was deleted?', 'woocommerce' ) );
	}
	if ( ! current_user_can( 'edit_others_shop_orders' ) && ! current_user_can( 'manage_woocommerce' ) ) {
		wp_die( esc_html__( 'You do not have permission to edit this order', 'woocommerce' ) );
	}
	if ( 'trash' === $this->order->get_status() ) {
		wp_die( esc_html__( 'You cannot edit this item because it is in the Trash. Please restore it and try again.', 'woocommerce' ) );
	}
}