From efdd4be1a18403041534fe6da758230e5aa207b9 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Mon, 3 Jul 2023 15:58:31 -0400 Subject: [PATCH] save --- classes/QueryMonitor.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/classes/QueryMonitor.php b/classes/QueryMonitor.php index b8417ba96..74a4bacaf 100644 --- a/classes/QueryMonitor.php +++ b/classes/QueryMonitor.php @@ -15,6 +15,7 @@ public function set_up() { # Actions add_action( 'plugins_loaded', array( $this, 'action_plugins_loaded' ) ); add_action( 'init', array( $this, 'action_init' ) ); + add_action( 'set_current_user', array( $this, 'action_set_current_user' ) ); add_action( 'members_register_caps', array( $this, 'action_register_members_caps' ) ); add_action( 'members_register_cap_groups', array( $this, 'action_register_members_groups' ) ); add_action( 'qm/cease', array( $this, 'action_cease' ) ); @@ -171,6 +172,27 @@ public function action_init() { load_plugin_textdomain( 'query-monitor', false, dirname( $this->plugin_base() ) . '/languages' ); } + /** + * @return void + */ + public function action_set_current_user() { + if ( is_admin() ) { + return; + } + + if ( ! apply_filters( 'qm/admin-bar/match-user-option', false ) ) { + return; + } + + $pref = get_user_option( 'show_admin_bar_front' ); + + if ( 'front' === $pref ) { + return; + } + + do_action( 'qm/cease' ); + } + /** * @return void */