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.

Share
Dieser Beitrag wurde unter Wordpress veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Eine Antwort auf Relevanssi User Searches: WPDB->prepare Error beheben

  1. Danke, denn die Herausforderung scheint bei dem Maintainer des Plugins imme rnoch nicht gelöst worden zu sein.
    Fohes Fest und einen guten rutsch

Hinterlasse eine Antwort

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

*


*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>