diff --git a/includes/class-api.php b/includes/class-api.php index 86bd3a2f..e43ff37a 100644 --- a/includes/class-api.php +++ b/includes/class-api.php @@ -1486,7 +1486,7 @@ public function get_disclosure_info( $as_parts = false ) { } $disclosure = [ - 'name' => empty( $account_info->organization_name ) ? constant_contact_get_option( '_ctct_disclose_name', '' ) : $account_info->organization_name, + 'name' => empty( $account_info['organization_name'] ) ? constant_contact_get_option( '_ctct_disclose_name', '' ) : $account_info['organization_name'], 'address' => constant_contact_get_option( '_ctct_disclose_address', '' ), ]; diff --git a/includes/class-settings.php b/includes/class-settings.php index 859ddac5..e4474577 100644 --- a/includes/class-settings.php +++ b/includes/class-settings.php @@ -451,7 +451,9 @@ protected function register_fields_optin() { $cmb = new_cmb2_box( $this->get_cmb_args( 'optin' ) ); if ( empty( $_GET['page'] ) || 'ctct_options_settings_optin' !== $_GET['page'] ) { - return; + if ( empty( $_POST ) ) { + return; + } } if ( constant_contact()->get_api()->is_connected() ) { @@ -497,27 +499,25 @@ protected function register_fields_optin() { ] ); - if ( empty( $disclosure_info ) ) { - $cmb->add_field( - [ - 'name' => esc_html__( 'Disclosure Name', 'constant-contact-forms' ), - 'id' => '_ctct_disclose_name', - 'type' => 'text', - 'default' => $business_name, - 'attributes' => ! empty( $business_name ) ? [ 'readonly' => 'readonly' ] : [], - ] - ); - - $cmb->add_field( - [ - 'name' => esc_html__( 'Disclosure Address', 'constant-contact-forms' ), - 'id' => '_ctct_disclose_address', - 'type' => 'text', - 'default' => $business_addr, - 'attributes' => ! empty( $business_addr ) ? [ 'readonly' => 'readonly' ] : [], - ] - ); - } + $cmb->add_field( + [ + 'name' => esc_html__( 'Disclosure Name', 'constant-contact-forms' ), + 'id' => '_ctct_disclose_name', + 'type' => 'text', + 'default' => $business_name, + 'attributes' => ! empty( $business_name ) ? [ 'readonly' => 'readonly' ] : [], + ] + ); + + $cmb->add_field( + [ + 'name' => esc_html__( 'Disclosure Address', 'constant-contact-forms' ), + 'id' => '_ctct_disclose_address', + 'type' => 'text', + 'default' => $business_addr, + 'attributes' => ! empty( $business_addr ) ? [ 'readonly' => 'readonly' ] : [], + ] + ); $cmb->add_field( [