Skip to content

Commit

Permalink
Merge pull request #1159 from xwp/bugfix/old-record-deleted
Browse files Browse the repository at this point in the history
Default options provided to "wp_stream_auto_purge" callbacks.
  • Loading branch information
kidunot89 authored Jan 5, 2021
2 parents 27ec833 + 9256fdb commit afef5a9
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', $defaults );
}

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

0 comments on commit afef5a9

Please sign in to comment.