time(), 'dismissed' => false, ]; update_option( self::OPTION_NAME, $options ); } // Check if the feedback notice was not dismissed already. if ( isset( $options['dismissed'] ) && ! $options['dismissed'] ) { $this->display(); } } /** * Display the user feedback notice. */ private function display() { // Fetch when plugin was initially activated. $activated = get_option( 'wp_mail_logging_activated_time' ); // Skip if the plugin is active for less than a defined number of days. if ( empty( $activated ) || ( $activated + ( DAY_IN_SECONDS * self::DELAY_NOTICE ) ) > time() ) { return; } $total_logs = get_transient( self::MAIL_LOGS_COUNT_TRANSIENT_KEY ); if ( $total_logs === false ) { $total_logs = Mail::query()->search( false )->find( true ); set_transient( self::MAIL_LOGS_COUNT_TRANSIENT_KEY, absint( $total_logs ), DAY_IN_SECONDS ); } // Only display the notice if our plugin is being used (has at least 10 email logs). if ( $total_logs < 10 ) { return; } ?>
blog_id ); update_option( self::OPTION_NAME, $options ); restore_current_blog(); } } wp_send_json_success(); } }