Support » Plugin: Simple Comment Editing » Bug when editing a published comment

  • Resolved FolioVision

    (@foliovision)


    Hello,

    this is a nice and quick plugin, however you should not use

    $comment_to_save['comment_approved'] == 'spam'

    As that is true even if $comment_to_save[‘comment_approved’] is 0. When editing a published comment it results in the “This comment was marked as spam” error message.

    Please use this condition and issue a plugin update:

    strcmp('spam',$comment_to_save['comment_approved']) == 0

    Thanks,
    Martin

    http://wordpress.org/plugins/simple-comment-editing/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ronald Huereca

    (@ronalfy)

    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

    Plugin Author Ronald Huereca

    (@ronalfy)

    I’ll be damned. I’ll push out an update soon. Thanks.

    Plugin Author Ronald Huereca

    (@ronalfy)

    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.

    Plugin Author Ronald Huereca

    (@ronalfy)

    ghacks, since this post is resolved, let’s move it to this thread: https://wordpress.org/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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bug when editing a published comment’ is closed to new replies.