aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/addalbum.php7
-rw-r--r--actions/upload.php9
-rw-r--r--start.php6
3 files changed, 16 insertions, 6 deletions
diff --git a/actions/addalbum.php b/actions/addalbum.php
index 909f04c9f..b53cf9692 100644
--- a/actions/addalbum.php
+++ b/actions/addalbum.php
@@ -41,19 +41,20 @@
$album->title = $title;
$album->description = $body;
+ // we catch the adding images to new albums in the upload action and throw a river new album event
+ $album->new_album = TP_NEW_ALBUM;
+
// Before we can set metadata, we need to save the album
if (!$album->save()) {
register_error(elgg_echo("album:error"));
forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page
}
- // Now let's add tags. We can pass an array directly to the object property! Easy.
+ // Now let's add tags
if (is_array($tagarray)) {
$album->tags = $tagarray;
}
- // we catch the adding images to new albums in the upload action and throw a river new album event
- $album->new_album = TP_NEW_ALBUM;
// Success message
diff --git a/actions/upload.php b/actions/upload.php
index 6911978b0..d5fb7d802 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -187,11 +187,16 @@
// update user/group size for checking quota
$image_repo_size += $sent_file['size'];
- // successful upload so check if this is a new album and throw river event if so
+ // successful upload so check if this is a new album and throw river event/notification if so
if ($album->new_album == TP_NEW_ALBUM) {
+ $album->new_album = TP_OLD_ALBUM;
+
+ // we throw the notification manually here so users are not told about the new album until there
+ // is at least a few photos in it
+ object_notifications('create', 'object', $album);
+
if (function_exists('add_to_river'))
add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);
- $album->new_album = TP_OLD_ALBUM;
}
if ($img_river_view == "all") {
diff --git a/start.php b/start.php
index c44c3cfc1..5a225e053 100644
--- a/start.php
+++ b/start.php
@@ -354,10 +354,14 @@
$method = $params['method'];
if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))
{
+ // block notification message when the album doesn't have any photos
+ if ($entity->new_album == TP_NEW_ALBUM)
+ return false;
+
$descr = $entity->description;
$title = $entity->title;
$owner = $entity->getOwnerEntity();
- return sprintf(elgg_echo('album:river:created'), $owner->name) . ' ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
}
return null;
}