Automattic\WooCommerce\Internal\Admin\Orders
PageController::handle_edit_lock()
Claims the lock for the order being edited/created (unless it belongs to someone else). Also handles the 'claim-lock' action which allows taking over the order forcefully.
Method of the class: PageController{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->handle_edit_lock();
PageController::handle_edit_lock() PageController::handle edit lock code WC 9.3.3
private function handle_edit_lock() { if ( ! $this->order ) { return; } $edit_lock = wc_get_container()->get( EditLock::class ); $locked = $edit_lock->is_locked_by_another_user( $this->order ); // Take over order? if ( ! empty( $_GET['claim-lock'] ) && wp_verify_nonce( $_GET['_wpnonce'] ?? '', 'claim-lock-' . $this->order->get_id() ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.MissingUnslash $edit_lock->lock( $this->order ); wp_safe_redirect( $this->get_edit_url( $this->order->get_id() ) ); exit; } if ( ! $locked ) { $edit_lock->lock( $this->order ); } add_action( 'admin_footer', function() use ( $edit_lock ) { $edit_lock->render_dialog( $this->order ); } ); }