Skip to content

Commit

Permalink
Default options provided to "wp_stream_auto_purge" callbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kidunot89 committed Jan 5, 2021
1 parent 3b79fc8 commit be813fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions classes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function __construct( $plugin ) {
add_filter( 'role_has_cap', array( $this, 'filter_role_caps' ), 10, 3 );

if ( is_multisite() && $plugin->is_network_activated() && ! is_network_admin() ) {
$options = (array) get_site_option( 'wp_stream_network', array() );
$options = (array) get_site_option( 'wp_stream_network', $plugin->settings->get_defaults() );
$option = isset( $options['general_site_access'] ) ? absint( $options['general_site_access'] ) : 1;

$this->disable_access = ( $option ) ? false : true;
Expand Down Expand Up @@ -746,10 +746,11 @@ public function purge_scheduled_action() {
return;
}

$defaults = $this->plugin->settings->get_defaults();
if ( is_multisite() && $this->plugin->is_network_activated() ) {
$options = (array) get_site_option( 'wp_stream_network', array() );
$options = (array) get_site_option( 'wp_stream_network', $defaults );
} else {
$options = (array) get_option( 'wp_stream', array() );
$options = (array) get_option( 'wp_stream', array(), $defaults );
}

if ( ! empty( $options['general_keep_records_indefinitely'] ) || ! isset( $options['general_records_ttl'] ) ) {
Expand Down

0 comments on commit be813fc

Please sign in to comment.