Skip to content

Commit

Permalink
馃悰 FIX: Default frontend sensors option values
Browse files Browse the repository at this point in the history
  • Loading branch information
asharirfan committed Sep 12, 2019
1 parent 128ed71 commit 40a606a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
18 changes: 14 additions & 4 deletions classes/Settings.php
Expand Up @@ -2247,12 +2247,22 @@ public function is_current_page( $page ) {
/**
* Get WSAL's frontend events option.
*
* @param mixed $default - Default value.
* @return array
*/
public function get_frontend_events( $default = false ) {
$event_opt = 'wsal-frontend-events';
$value = ! is_multisite() ? get_option( $event_opt, $default ) : get_network_option( get_main_network_id(), $event_opt, $default );
public function get_frontend_events() {
// Option defaults.
$default = array(
'register' => false,
'login' => false,
'system' => false,
'woocommerce' => WpSecurityAuditLog::is_woocommerce_active(),
);

// Get the option.
$event_opt = 'wsal-frontend-events';
$value = ! is_multisite() ? get_option( $event_opt, $default ) : get_network_option( get_main_network_id(), $event_opt, $default );

// Check for WooCommerce in case it is not stored.
$value['woocommerce'] = ! isset( $value['woocommerce'] ) ? WpSecurityAuditLog::is_woocommerce_active() : $value['woocommerce'];
return $value;
}
Expand Down
8 changes: 1 addition & 7 deletions classes/Views/ToggleAlerts.php
Expand Up @@ -610,13 +610,7 @@ class="alert"
</div>
<?php endforeach; ?>
<?php
$defaults = array(
'register' => false,
'login' => false,
'system' => false,
'woocommerce' => false,
);
$frontend_events = $this->_plugin->settings->get_frontend_events( $defaults );
$frontend_events = $this->_plugin->settings->get_frontend_events();
?>
<table id="tab-frontend-events" class="form-table wp-list-table wsal-tab widefat fixed" style="display: table;" cellspacing="0">
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion wp-security-audit-log.php
Expand Up @@ -1434,7 +1434,7 @@ public function Update( $old_version, $new_version ) {
'register' => true, // Enabled by default to ensure users to not loose any functionality.
'login' => true, // Enabled by default to ensure users to not loose any functionality.
'system' => false,
'woocommerce' => false,
'woocommerce' => self::is_woocommerce_active(),
);

// If event 6023 is enabled.
Expand Down

0 comments on commit 40a606a

Please sign in to comment.