From 58e702ff5a328eb704d29da985863a646a193331 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Fri, 3 Jun 2011 10:42:13 -0700 Subject: Added moderator email notifications --- htdocs/src/Post.inc.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'htdocs/src/Post.inc.php') diff --git a/htdocs/src/Post.inc.php b/htdocs/src/Post.inc.php index e36884b..93b1369 100644 --- a/htdocs/src/Post.inc.php +++ b/htdocs/src/Post.inc.php @@ -175,6 +175,7 @@ class Post { public function verify() { if ($this->getStage() == 'verification') { $this->info['stage'] = 'moderation'; + $this->notifyModerators(); } } @@ -333,6 +334,25 @@ class Post { $email->send(); } + + public function notifyModerators() { + $ui = new UserIterator(); + $ui->filterNotify(true); + $ui->query(); + + $url = buildUrl('postings/' . $this->getId() .'.html?moderate'); + + $email = new Email(''); + $email->setSubject('[' . $GLOBALS['CONFIG']['sitetitle'] . '] New Posting to Moderate'); + $email->appendMessage("A new posting is awaiting moderation.\nYou can view the post at $url"); + + if ($ui->valid()) { + foreach($ui as $user) { + $email->setTo($user->getEmail()); + $email->send(); + } + } + } } ?> -- cgit v1.2.3