Skip to content

Commit

Permalink
[opt-in] Fixed an issue with the opt-in moderation and API connectivi…
Browse files Browse the repository at this point in the history
…ty test logic.
  • Loading branch information
fajardoleo authored and swashata committed Jun 30, 2024
1 parent c23bd6b commit a441b57
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -4174,13 +4174,17 @@ function has_api_connectivity( $flush_if_no_connectivity = false ) {
! empty( $this->_storage->connectivity_test ) &&
isset( $this->_storage->connectivity_test['is_active'] )
) {
$is_active = $this->_storage->connectivity_test['is_active'];
$is_connected = isset( $this->_storage->connectivity_test['is_connected'] ) ?
$this->_storage->connectivity_test['is_connected'] :
null;
$is_active = ( $this->_storage->connectivity_test['is_active'] || is_object( $this->_site ) );
} else {
$is_active = $this->should_turn_fs_on( $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() ) );

$this->store_connectivity_info( (object) array( 'is_active' => $is_active ), null );
$is_connected = null;
$is_active = $this->should_turn_fs_on( $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() ) );
}

$this->store_connectivity_info( (object) array( 'is_active' => $is_active ), $is_connected );

if ( $is_active ) {
$this->_is_on = true;
}
Expand Down Expand Up @@ -5484,7 +5488,12 @@ private function parse_settings( &$plugin_info ) {
'affiliate_moderation' => $this->get_option( $plugin_info, 'has_affiliation' ),
'bundle_id' => $this->get_option( $plugin_info, 'bundle_id', null ),
'bundle_public_key' => $this->get_option( $plugin_info, 'bundle_public_key', null ),
'opt_in_moderation' => $this->get_option( $plugin_info, 'opt_in', null ),
'opt_in_moderation' => $this->get_option(
$plugin_info,
'opt_in',
// For backward compatibility, we support both parameter names: opt_in and opt_in_moderation.
$this->get_option( $plugin_info, 'opt_in_moderation', null )
),
) );

if ( $plugin->is_updated() ) {
Expand Down

0 comments on commit a441b57

Please sign in to comment.