WordPress.org

Ready to get started?Download WordPress

Forums

WP Ajax Edit Comments bug when handling smileys? (6 posts)

  1. SuperCoco
    Member
    Posted 6 years ago #

    Imagine that you write a comment in a WP blog like the following one:

    *******
    paragraph1 :-)

    paragraph2 ;-)

    paragraph3
    *******

    WP generates the following HTML code for it:

    *******
    <p>paragraph1 <img src="http://blogurl/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"> </p>
    <p>paragraph2 <img src="http://blogurl/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley"> </p>
    <p>paragraph3</p>
    *******

    But now, if we edit the comment with wp-ajax-edit-comments. For example, a minor change:

    *******
    paragraph1 :-)

    paragraph2 ;-)

    paragraph33
    *******

    WP Ajax Edit Comments adds a <br> tag at the end of each smiley

    *******
    <p>paragraph1 <img src="http://blogurl/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"><br>
    paragraph2 <img src="http://blogurl/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley"><br>
    paragraph33</p>
    *******

    Because of that, at least with my theme, the comment looks like:

    *******
    paragraph1 :-)
    paragraph2 ;-)
    paragraph3
    *******

    If you add a dot (.) after the smiley, the problem doesn't appear:

    *******
    paragraph1 :-) .

    paragraph2 ;-)
    paragraph33
    *******

    So, why does WP Ajax Edit Comments add those extra <br>? Don't you think this is a bug? It should respect the formatting of comments as WP leaves them...

  2. Ronald Huereca
    Member
    Posted 6 years ago #

    SuperCoco,

    I've addressed your bug in version v1.1.5.2. At this moment, it seems the solution may be worse than the problem. I'll let you decide. I haven't released officially, but you're welcome to try the developmental version.

    What's happening is WordPress is incorrectly filtering input sent from AJAX. I tried another plugin that does AJAX replies, and the same thing occurs that you are talking about.

    Here's what's happening behind the scenes in my fix.

    When you are saving a comment, the newline characters are converted to BRs. I'll use the example you gave.

    paragraph1 :-)
    
    paragraph2 ;-)
    
    paragraph3

    When initially leaving this comment, it's displayed as you have mentioned:

    <p>paragraph1 <img src="http://blogurl/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"> </p>
    <p>paragraph2 <img src="http://blogurl/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley"> </p>
    <p>paragraph3</p>

    When making the change, it the code is now:

    <p>paragraph1 <img src="http://127.0.0.1/raproject/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"> <br class="wpaec"><br class="wpaec">paragraph2 <img src="http://127.0.0.1/raproject/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley"> <br class="wpaec"><br class="wpaec">paragraph33</p>

    It displays the same, but there are now BRs instead of new paragraphs.

    I will continue to work on a better solution, but it might take me longer than I had originally anticipated.

  3. Ronald Huereca
    Member
    Posted 6 years ago #

    This may very well be a WordPress bug, so I've submitted an official bug report to WP: http://trac.wordpress.org/ticket/6099

  4. Ronald Huereca
    Member
    Posted 6 years ago #

    I'm almost positive now that this is a WP bug that has to deal with smilies. If you disable smilies in the Options->Writing panel, this bug disappears.

    I'm still trying to convince the people on Trac that this isn't a plugin issue. This happens on every AJAX plugin that posts comments to the database.

  5. helmeloh
    Member
    Posted 5 years ago #

    Well, I guess the bug has been closed, but it's still the same in WP Version 2.6.3

    If I enable Writing Settings --> Formatting -->
    Formatting Convert emoticons like :-) and :-P to graphics on display, the comments are no valid HTML.
    If I disable this option it's valid HTML. ;-)

  6. helmeloh
    Member
    Posted 5 years ago #

    I'sorry, that was my error, because a plugin changed the source. It happens really often that plugins produces a invalid HTML.

Topic Closed

This topic has been closed to new replies.

About this Topic