WPBook mit SI Captcha und Kommentarimport

Wenn man zusammen mit WPBook das Plugin SI Captcha Antispam verwendet, funktioniert der Kommentarimport leider nicht. Der Grund dafür ist, dass WPBook neue Kommentare durch den Filter preprocess_comment schickt. Hier greift jedoch SI Captcha ein. Und wenn das Teil kein gültiges Captcha erhält, wird der Kommentar ignoriert. Die einfachste Lösung ist, diesen Filter in WPBook zu deaktivieren. Dazu muss man unter Plugins > Editor die Datei wpbook/includes/wpbook_cron.php bearbeiten und ein bestimmte Zeile auskommentieren. Es geht hier um die Zeile mit // am Anfang. Das // habe ich hinzugefügt, um den Filter zu deaktivieren:

/* I'd like to use wp_new_comment here, but:
*   - It ignores the timestamp passed in and uses now instead
*   - It calls wp_allow_comment which in turn invokes comment flood throttle
* So instead I use wp_insert_comment but replicate some of the filtering
*           $my_id = wp_new_comment($data); 
*/
//$data = apply_filters('preprocess_comment', $data); // filtering normally done by wp_new_comment
$data['comment_parent'] = isset($data['comment_parent']) ? absint($data['comment_parent']) : 0;
$parent_status = ( 0 < $data['comment_parent'] ) ? wp_get_comment_status($data['comment_parent']) : '';
$data['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $data['comment_parent'] : 0;
Tags » , «

Autor:
Datum: Donnerstag, 28. Juni 2012 23:11
Trackback: Trackback-URL Themengebiet: IT

Feed zum Beitrag: RSS 2.0 Diesen Artikel kommentieren

Kommentar abgeben

*