From 4db2806458b1bc65aab9c5cabe9ddede0ce9713f Mon Sep 17 00:00:00 2001 From: jamesros Date: Mon, 19 Dec 2022 18:26:30 -0500 Subject: [PATCH] Update class-boldgrid-connect.php --- includes/class-boldgrid-connect.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/class-boldgrid-connect.php b/includes/class-boldgrid-connect.php index 78b5b84..8cc9c1a 100644 --- a/includes/class-boldgrid-connect.php +++ b/includes/class-boldgrid-connect.php @@ -204,8 +204,19 @@ private function overrideConfigs() { * @return false|mixed (Maybe) filtered option value. */ add_filter( 'option_bg_connect_configs', function( $value, $option ) { + /** + * The BoldGrid Library applies this filter before the + * 'configs' service gets registered above. In order for this + * value to not be 'null', we need to run setup_configs() here + * as well. Just checking for a null value doesn't work below, + * because the Boldgrid_Connect_Service::get() method throws an + * error if the requested service hasn't been registered + */ + $config = new Boldgrid_Connect_Config(); + $config->setup_configs(); + $value = is_array( $value ) ? $value : []; - $conf = \Boldgrid_Connect_Service::get( 'configs' ); + $conf = \Boldgrid_Connect_Service::get( 'configs' ); $confs = ! empty( $conf ) ? array_merge( $conf, $value ) : $value; @@ -214,8 +225,6 @@ private function overrideConfigs() { foreach ( $confs['branding'] as $brand => $opts ) { if ( strpos( strtolower( $brand ), $confs['brand'] ) !== false ) { update_site_option( 'boldgrid_connect_provider', $brand ); - // This option controls hiding various menu items from the plugins/library. - update_site_option( 'boldgrid_connect_hide_menu', $brand === 'InMotion Hosting' ); } } }