Scared of the Peacock Revolution since 2006
Blog » Comment updates and stuff!
Comments now have an email field. At the moment this is only used to grab a gravatar to display with your comment, but will soon be expanded to allow you to receive email updates and stuff like that. I don't it's compulsory yet, though I should change that.
Quoting from the email I sent to ss-dev about this:
I am currently working on extending the PageComment functionality with SilverStripe. As I'm sure most of you are aware, it is rather limited at the moment.
My extension works as a module (available from http://simon.geek.nz/comments.tar.gz), which will allow you to use the extra functionality I have currently made. To add them to a page type, there's two small edits you need to make:
- Add "Comments" => "BlogComment" to your $has_many
- Add:
function PageComments() {
$hasComments = DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"PageComment\".\"ParentID\" = '". Convert::raw2sql($this->ID) . "'")->value();
if(($this->data() && $this->data()->ProvideComments) || ($hasComments > 0 && PageCommentInterface::$show_comments_when_disabled)) {
return new BlogCommentInterface($this, 'PageComments', $this->data());
} else {
if(isset($_REQUEST['executeForm']) && $_REQUEST['executeForm'] == 'PageComments.PostCommentForm') {
echo "Comments have been disabled for this page";
die();
}
}
}
to your Controller.By default, this will:
- Add an email field to the form
- Allow email notifications of replies
- Name and email for logged in users is pre-populated and can't be changed
- Avatars are displayed. Currently they are 32x32 pixels. The avatar is either grabbed from $member->Avatar() (if it exists and returns an Image) or a gravatar (see http://gravatar.com)
- Logged in users are not required to fill in the spam protection forms. This will become an option in a later release.There is also support for Twitter OAuth. This requires you to set up your site as a Twitter app (at http://twitter.com/apps/new) then provide your customer key and secret by editing comments/_config.php. This support, so far, allows:
- Pre-population of name and website
- Twitter avatar to be used
- Tweeting on posting a comment (see http://search.twitter.com/search?q=commented+source%3Aelephpanthaven for my testing of this)
Currently, you can't subscribe to email notifications if you're signed in with Twitter.This is all working and can be seen at http://simon.geek.nz/comment-updates-and-stuff/
Todo:
- Facebook and OpenID integration (similar to Twitter's)
- Email notifications for Twitter logins
- Replies to comments
- Better control over the display (new at bottom, no pages, etc)
- Things I have yet to think up.I will eventually figure out how to open the SVN repository for this as well.
I have feet.
Dit is zwei test

Cheers!
Dit is een test

Mega Cool!
Erg leuk!
Nice!!
Fine. I'll add in an option.
The name for posting you muppet. I wants yomcat!

Email notification now works. Just not for Twitter accounts.
RSS feed for comments on this page | RSS feed for all comments