Skip to content

Commit

Permalink
Comment notification extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mooyman committed Apr 9, 2015
1 parent 32c1851 commit 81c0ca2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _config/comments.yml
Expand Up @@ -6,3 +6,12 @@ Only:
Comment:
extensions:
- BlogCommentExtension

---
Name: blogcommentnotifications
Only:
moduleexists: 'comment-notifications'
---
BlogPost:
extensions:
- BlogPostNotifications
30 changes: 30 additions & 0 deletions code/extensions/BlogPostNotifications.php
@@ -0,0 +1,30 @@
<?php

/**
* Customise blog post to support comment notifications
* Extends {@see BlogPost} with extensions to {@see CommentNotifiable}
*/
class BlogPostNotifications extends DataExtension {

/**
* Notify all authors of notifications
*
* @param type $list
* @param type $comment
*/
public function updateNotificationRecipients(&$list, &$comment) {
// Notify all authors
$list = $this->owner->Authors();
}

/**
* Update comment to include the page title
*
* @param string $subject
* @param Comment $comment
* @param Member|string $recipient
*/
public function updateNotificationSubject(&$subject, &$comment, &$recipient) {
$subject = "A new comment has been posted on " . $this->owner->Title;
}
}

0 comments on commit 81c0ca2

Please sign in to comment.