Relevanssi User Searches: WPDB->prepare Error beheben

Auch das Relevanssi User Searches Plugin zeigt in der Dashboard Übersicht WPDB->prepare Fehler unter WordPress 3.5

 Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/vhosts/xyz.de/
 subdomains/test/httpdocs/wp-content/plugins/relevanssi/lib/interface.php on line 498
 and defined in /var/www/vhosts/xyz.de/subdomains/test/httpdocs/wp-includes/wp-db.php
 on line 990
 Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/vhosts/xyz.de/
 subdomains/test/httpdocs/wp-content/plugins/relevanssi/lib/interface.php on line 499
 and defined in /var/www/vhosts/xyz.de/subdomains/test/httpdocs/wp-includes/wp-db.php
 on line 990
 Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/vhosts/xyz.de/
 subdomains/test/httpdocs/wp-content/plugins/relevanssi/lib/interface.php on line 500
 and defined in /var/www/vhosts/xyz.de/subdomains/test/httpdocs/wp-includes/wp-db.php
 on line 990
 Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/vhosts/xyz.de/
 subdomains/test/httpdocs/wp-content/plugins/relevanssi/lib/interface.php on line 501
 and defined in /var/www/vhosts/xyz.de/subdomains/test/httpdocs/wp-includes/wp-db.php
 on line 990

Wer nicht warten möchte bis das Update des Plugins da ist, tauscht die Zeilen 498-501 in  /wp-content/plugins/relevanssi/lib/interface.php

$count['Today and yesterday'] = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM $log_table WHERE TIMESTAMPDIFF(DAY, time, NOW()) <= 1;" ) );
$count['Last 7 days'] = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM $log_table WHERE TIMESTAMPDIFF(DAY, time, NOW()) <= 7;" ) );
$count['Last 30 days'] = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM $log_table WHERE TIMESTAMPDIFF(DAY, time, NOW()) <= 30;" ) );
$count['Forever'] = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM $log_table;" ) );

aus und ersetzt sie mit diesen Zeilen

$count['Today and yesterday'] = $wpdb->get_var( "SELECT COUNT(id) FROM $log_table WHERE TIMESTAMPDIFF(DAY, time, NOW()) <= 1;"  );
$count['Last 7 days'] = $wpdb->get_var( "SELECT COUNT(id) FROM $log_table WHERE TIMESTAMPDIFF(DAY, time, NOW()) <= 7;"  );
$count['Last 30 days'] = $wpdb->get_var( "SELECT COUNT(id) FROM $log_table WHERE TIMESTAMPDIFF(DAY, time, NOW()) <= 30;" );
$count['Forever'] = $wpdb->get_var( "SELECT COUNT(id) FROM $log_table;" );

Der Hintergrund findet sich hier.

1 Antwort

Dein Kommentar

Want to join the discussion?
Feel free to contribute!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.