aboutsummaryrefslogtreecommitdiff
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
parenta4a8fe024a3160509bdf41d095531d5647f98c51 (diff)
downloadelgg-803d32e0a49325ad961161be193a9ad73e3dc211.tar.gz
elgg-803d32e0a49325ad961161be193a9ad73e3dc211.tar.bz2
added basic notifications on album creation
-rw-r--r--edit_multi.php3
-rw-r--r--languages/en.php6
-rw-r--r--start.php28
3 files changed, 34 insertions, 3 deletions
diff --git a/edit_multi.php b/edit_multi.php
index 501e23102..570245595 100644
--- a/edit_multi.php
+++ b/edit_multi.php
@@ -17,7 +17,6 @@
// set owner of page based on first photo guid
$photo_guid = (int)$file_array_sent[0];
$photo = get_entity($photo_guid);
- error_log($photo_guid);
// set page owner based on owner of photo album
set_page_owner($photo->owner_guid);
@@ -44,4 +43,4 @@
$area2 .= elgg_view("tidypics/forms/edit_multi", array('file_array' => $new_file_array, 'album_guid' => $album_guid));
$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
page_draw($title, $body);
-?> \ No newline at end of file
+?>
diff --git a/languages/en.php b/languages/en.php
index e076ee8de..6b2d51374 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -72,7 +72,11 @@
//albums
'album:river:created' => "%s created a new photo album: ",
'album:river:item' => "an album",
- 'album:river:annotate' => "a comment on the photo album",
+ 'album:river:annotate' => "a comment on the photo album",
+
+ // notifications
+ 'tidypics:newalbum' => 'New photo album',
+
// Status messages
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
*