From 803d32e0a49325ad961161be193a9ad73e3dc211 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 19:12:34 +0000 Subject: added basic notifications on album creation --- start.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'start.php') 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 * -- cgit v1.2.3