aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-03-28 19:12:34 +0000
committerCash Costello <cash.costello@gmail.com>2009-03-28 19:12:34 +0000
commit803d32e0a49325ad961161be193a9ad73e3dc211 (patch)
tree9a35eb1a510b7d438b7e6bb9d53a71ebc1e81d0d /start.php
parenta4a8fe024a3160509bdf41d095531d5647f98c51 (diff)
downloadelgg-803d32e0a49325ad961161be193a9ad73e3dc211.tar.gz
elgg-803d32e0a49325ad961161be193a9ad73e3dc211.tar.bz2
added basic notifications on album creation
Diffstat (limited to 'start.php')
-rw-r--r--start.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/start.php b/start.php
index dc1456a57..abf285f7e 100644
--- a/start.php
+++ b/start.php
@@ -43,6 +43,13 @@
add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
+
+ // Register for notifications
+ if (is_callable('register_notification_object')) {
+ register_notification_object('object', 'album', elgg_echo('tidypics:newalbum'));
+
+ register_plugin_hook('notify:entity:message', 'object', 'tidypics_notify_message');
+ }
}
/**
@@ -195,6 +202,27 @@
return false;
}
+
+ /**
+ * Notification message handler
+ */
+ function tidypics_notify_message($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))
+ {
+ $descr = $entity->description;
+ $title = $entity->title;
+ if ($method == 'email') {
+ $owner = $entity->getOwnerEntity();
+ return sprintf(elgg_echo('album:river:created'), $owner->username) . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ }
+ return null;
+ }
+
/**
* Populates the ->getUrl() method for file objects
*