From cd637863cccf4d9f8caedd74740108edfe6fd62a Mon Sep 17 00:00:00 2001 From: Xenos Date: Fri, 2 Nov 2018 16:54:50 +0100 Subject: [PATCH] Wrong first parameter value Expected: date format, got "null" leading to duplicate entry issues https://wordpress.org/support/topic/duplicate-entry-for-key-unique_date/ --- schedule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schedule.php b/schedule.php index f801ff9..98b4026 100644 --- a/schedule.php +++ b/schedule.php @@ -116,7 +116,7 @@ function wp_statistics_addcron( $schedules ) { function wp_statistics_add_visit_event() { GLOBAL $wpdb, $WP_Statistics; - $sqlstring = $wpdb->prepare( 'INSERT INTO ' . $wpdb->prefix . 'statistics_visit (last_visit, last_counter, visit) VALUES ( %s, %s, %d)', $WP_Statistics->Current_Date(null, '+1'), $WP_Statistics->Current_date('Y-m-d', '+1'), 0 ); + $sqlstring = $wpdb->prepare( 'INSERT INTO ' . $wpdb->prefix . 'statistics_visit (last_visit, last_counter, visit) VALUES ( %s, %s, %d)', $WP_Statistics->Current_Date('Y-m-d', '+1'), $WP_Statistics->Current_date('Y-m-d', '+1'), 0 ); $wpdb->query( $sqlstring ); } @@ -234,4 +234,4 @@ function wp_statistics_send_report() { } } add_action('report_hook', 'wp_statistics_send_report'); -?> \ No newline at end of file +?>