From be813fc4d81b88d4f260d5e9bab8e24760e1bba0 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Aug 2020 15:21:28 -0400 Subject: [PATCH 1/2] Default options provided to "wp_stream_auto_purge" callbacks. --- classes/class-admin.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/classes/class-admin.php b/classes/class-admin.php index 829c898f1..c80ab6949 100644 --- a/classes/class-admin.php +++ b/classes/class-admin.php @@ -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; @@ -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'] ) ) { From 9256fdb698319241e345303f6ee2253a14f9f812 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Thu, 20 Aug 2020 15:28:57 -0400 Subject: [PATCH 2/2] "get_option" function call fixed. --- classes/class-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-admin.php b/classes/class-admin.php index c80ab6949..15148bfab 100644 --- a/classes/class-admin.php +++ b/classes/class-admin.php @@ -750,7 +750,7 @@ public function purge_scheduled_action() { if ( is_multisite() && $this->plugin->is_network_activated() ) { $options = (array) get_site_option( 'wp_stream_network', $defaults ); } else { - $options = (array) get_option( 'wp_stream', array(), $defaults ); + $options = (array) get_option( 'wp_stream', $defaults ); } if ( ! empty( $options['general_keep_records_indefinitely'] ) || ! isset( $options['general_records_ttl'] ) ) {