Are you talking about the line:
if ( $comment_to_save['comment_approved'] == 'spam' ) {
How would that default to true if the comment is marked as 0?
Hello Ronald,
you should be using strcmp() or === instead of just ==. You can try the following example:
<?php
var_dump(0=='spam'); // true - not what we want
var_dump(0==='spam'); // false - correct!
var_dump('spam'==='spam'); // true - correct! This is the one to use
var_dump('SPAM'==='spam'); // false - because the case doesn't match
var_dump(strcasecmp('SPAM','spam')); // 0 - correct
?>
Thanks,
Martin
I’ll be damned. I’ll push out an update soon. Thanks.
I just pushed 1.1.1 with the fix. Thanks for the help.
I seem to have a related problem. Some comments are marked as spam on my site after they have been edited even though that should not be the case.
I cannot really say why this is happening, but it is happening especially when someone posts a long comment on the site and then edits it.
An example is this comment: http://www.ghacks.net/2014/02/21/telegram-questions-answered-whatsapp-messenger-alternative/#comment-1993903
It was marked as spam and I had to move it mark it as legit so that it would appear on the site.
ghacks, since this post is resolved, let’s move it to this thread: https://ww.wp.xz.cn/support/topic/comments-marked-as-spam-when-editing
I’ll do my own internal testing to see if I can duplicate the problem.
An edited comment is run through several checks, notably a check_comment check, a wp_blacklist_check, and if Akismet is installed, it checks it there too. If you’re familiar with code, it’s all in the ajax_save_comment method.
Just let me know if there’s any way to duplicate it consistently. I’ll do checks on my end as well.
Sorry about the inconvenience.