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 --- edit_multi.php | 3 +-- languages/en.php | 6 +++++- start.php | 28 ++++++++++++++++++++++++++++ 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 * -- cgit v1.2.3