Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » improvement for "Recent Page Comments Widget"

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1109 Views
  • Anatol
    126 Posts

    improvement for "Recent Page Comments Widget" Link to this post

    Hi Forum,

    I quite liked the Recent Page Comments Widget, so I added it to my blog. However, some spam posts that managed to pass the Akismet spam protection broke my website completely. All pages that contained the Recent Page Comment Widget displayed a rather ugly error message pointing at a blockquote end tag.

    This is hardly surprising because the Recent Pages Comments Widget limits the characters that are displayed without considering that it may just leave an unclosed html tag behind. Here is an example:

    This is <a href="http://www.i-eat-your-soul.com/annoying/nasty/evil/">spam</a>.

    If this is trimmed it becomes

    This is <a href="http://www.i-eat
    and is rendered as something like
    <blockquote>This is <a href="http://www.i-eat</blockquote>

    So Silverstripe notices that the html of this page is completely messed up and complains with an error message.

    A quick way to fix this is to make a small change in the silverstripe_root_directory/widgets_pagecomments/PageCommentsWidget.php file. Add the bold blue code to line 39:


    This should strip out all html tags before the string is trimmed to a certain character length.


  • simon_w
    Forum Moderator
    474 Posts

    Re: improvement for "Recent Page Comments Widget" Link to this post

    Updated and uploaded for review.

    Thanks (:

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.