Automattic\WooCommerce\Internal\Admin\Orders
PageController::verify_edit_permission()
Verify that user has permission to edit orders.
Метод класса: PageController{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->verify_edit_permission();
Код PageController::verify_edit_permission() PageController::verify edit permission WC 9.3.3
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 ( $this->order->get_type() !== $this->order_type ) { wp_die( esc_html__( 'Order type mismatch.', 'woocommerce' ) ); } if ( ! current_user_can( get_post_type_object( $this->order_type )->cap->edit_post, $this->order->get_id() ) && ! 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' ) ); } }