Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

improvement for "Recent Page Comments Widget"

Go to End

2 Posts   1360 Views


126 Posts

25 March 2008 at 11:45am

Edited: 25/03/2008 11:48am

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="">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.



Community Member, 473 Posts

26 March 2008 at 7:42am

Updated and uploaded for review.

Thanks (: