Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions classes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +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() );
$option = isset( $options['general_site_access'] ) ? absint( $options['general_site_access'] ) : 1;

$option = isset( $this->plugin->settings->options['general_site_access'] ) ? absint( $this->plugin->settings->options['general_site_access'] ) : 1;
$this->disable_access = ( $option ) ? false : true;
}

Expand Down Expand Up @@ -746,18 +744,12 @@ 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', $defaults );
} else {
$options = (array) get_option( 'wp_stream', $defaults );
}

if ( ! empty( $options['general_keep_records_indefinitely'] ) || ! isset( $options['general_records_ttl'] ) ) {
if ( ! empty( $this->plugin->settings->options['general_keep_records_indefinitely'] ) || ! isset( $this->plugin->settings->options['general_records_ttl'] ) ) {
return;
}

$days = $options['general_records_ttl'];
$days = $this->plugin->settings->options['general_records_ttl'];
$timezone = new DateTimeZone( 'UTC' );
$date = new DateTime( 'now', $timezone );

Expand Down
5 changes: 1 addition & 4 deletions tests/tests/test-class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,10 @@ public function test_purge_schedule_setup() {

public function test_purge_scheduled_action() {
// Set the TTL to one day
$this->plugin->settings->options['general_records_ttl'] = '1';
if ( is_multisite() && is_plugin_active_for_network( $this->plugin->locations['plugin'] ) ) {
$options = (array) get_site_option( 'wp_stream_network', array() );
$options['general_records_ttl'] = '1';
update_site_option( 'wp_stream_network', $options );
} else {
$options = (array) get_option( 'wp_stream', array() );
$options['general_records_ttl'] = '1';
update_option( 'wp_stream', $options );
}

Expand Down