diff --git a/classes/class-db.php b/classes/class-db.php index 28cedd74c..797cab08c 100644 --- a/classes/class-db.php +++ b/classes/class-db.php @@ -99,7 +99,7 @@ public function insert( $recordarr ) { $fields = array( 'object_id', 'site_id', 'blog_id', 'user_id', 'user_role', 'created', 'summary', 'ip', 'connector', 'context', 'action' ); $data = array_intersect_key( $recordarr, array_flip( $fields ) ); - $data = array_filter( $data ); + $result = $wpdb->insert( $this->table, $data ); if ( 1 !== $result ) { diff --git a/classes/class-log.php b/classes/class-log.php index 9e301665e..f93b3fe78 100644 --- a/classes/class-log.php +++ b/classes/class-log.php @@ -114,6 +114,10 @@ function( &$v ) { 'meta' => (array) $stream_meta, ); + if ( 0 === $recordarr['object_id'] ) { + unset( $recordarr['object_id'] ); + } + $result = $this->plugin->db->insert( $recordarr ); $this->debug_backtrace( $recordarr ); @@ -156,6 +160,22 @@ public function is_record_excluded( $connector, $context, $action, $user = null, $exclude_settings = isset( $this->plugin->settings->options['exclude_rules'] ) ? $this->plugin->settings->options['exclude_rules'] : array(); + if ( is_multisite() && is_plugin_active_for_network( $this->plugin->locations['plugin'] ) && ! is_network_admin() ) { + $multisite_options = (array) get_site_option( 'wp_stream_network', array() ); + $multisite_exclude_settings = isset( $multisite_options['exclude_rules'] ) ? $multisite_options['exclude_rules'] : array(); + + if ( ! empty( $multisite_exclude_settings ) ) { + foreach ( $multisite_exclude_settings['exclude_row'] as $key => $rule ) { + $exclude_settings['exclude_row'][] = $multisite_exclude_settings['exclude_row'][ $key ]; + $exclude_settings['author_or_role'][] = $multisite_exclude_settings['author_or_role'][ $key ]; + $exclude_settings['connector'][] = $multisite_exclude_settings['connector'][ $key ]; + $exclude_settings['context'][] = $multisite_exclude_settings['context'][ $key ]; + $exclude_settings['action'][] = $multisite_exclude_settings['action'][ $key ]; + $exclude_settings['ip_address'][] = $multisite_exclude_settings['ip_address'][ $key ]; + } + } + } + if ( isset( $exclude_settings['exclude_row'] ) && ! empty( $exclude_settings['exclude_row'] ) ) { foreach ( $exclude_settings['exclude_row'] as $key => $value ) { // Prepare values diff --git a/classes/class-settings.php b/classes/class-settings.php index 68d566927..baeb81ab0 100644 --- a/classes/class-settings.php +++ b/classes/class-settings.php @@ -569,12 +569,20 @@ public function render_field( $field ) { ); break; case 'checkbox': + if ( isset( $current_value ) ) { + $value = $current_value; + } elseif ( isset( $default ) ) { + $value = $default; + } else { + $value = 0; + } + $output = sprintf( '', esc_attr( $option_key ), esc_attr( $section ), esc_attr( $name ), - checked( $current_value, 1, false ), + checked( $value, 1, false ), wp_kses_post( $after_field ) ); break;