summaryrefslogtreecommitdiff
path: root/htdocs/src
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2011-06-03 10:42:13 -0700
committerJesse Morgan <jesse@jesterpm.net ; true>2011-06-03 10:42:13 -0700
commit58e702ff5a328eb704d29da985863a646a193331 (patch)
tree0d5fbec71601077e1c26d82900b49b84fce356c4 /htdocs/src
parentbdd963a85e811b5987917b6e2d67dd6c87de2b54 (diff)
Added moderator email notifications
Diffstat (limited to 'htdocs/src')
-rw-r--r--htdocs/src/Email.inc.php4
-rw-r--r--htdocs/src/Post.inc.php20
2 files changed, 24 insertions, 0 deletions
diff --git a/htdocs/src/Email.inc.php b/htdocs/src/Email.inc.php
index b828780..52eb52f 100644
--- a/htdocs/src/Email.inc.php
+++ b/htdocs/src/Email.inc.php
@@ -23,6 +23,10 @@ class Email {
$this->headers = array();
}
+ public function setTo($to) {
+ $this->to = $to;
+ }
+
public function setFrom($from) {
$this->from = $from;
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();
+ }
+ }
+ }
}
?>