aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
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
*