$album->title = $title;\r
$album->description = $body;\r
\r
+ // we catch the adding images to new albums in the upload action and throw a river new album event \r
+ $album->new_album = TP_NEW_ALBUM;\r
+ \r
// Before we can set metadata, we need to save the album\r
if (!$album->save()) {\r
register_error(elgg_echo("album:error"));\r
forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page\r
}\r
\r
- // Now let's add tags. We can pass an array directly to the object property! Easy.\r
+ // Now let's add tags\r
if (is_array($tagarray)) {\r
$album->tags = $tagarray;\r
}\r
\r
- // we catch the adding images to new albums in the upload action and throw a river new album event \r
- $album->new_album = TP_NEW_ALBUM;\r
\r
\r
// Success message\r
// update user/group size for checking quota\r
$image_repo_size += $sent_file['size'];\r
\r
- // successful upload so check if this is a new album and throw river event if so\r
+ // successful upload so check if this is a new album and throw river event/notification if so\r
if ($album->new_album == TP_NEW_ALBUM) {\r
+ $album->new_album = TP_OLD_ALBUM;\r
+\r
+ // we throw the notification manually here so users are not told about the new album until there\r
+ // is at least a few photos in it\r
+ object_notifications('create', 'object', $album);\r
+ \r
if (function_exists('add_to_river'))\r
add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid);\r
- $album->new_album = TP_OLD_ALBUM;\r
}\r
\r
if ($img_river_view == "all") {\r
$method = $params['method'];\r
if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'album'))\r
{\r
+ // block notification message when the album doesn't have any photos\r
+ if ($entity->new_album == TP_NEW_ALBUM)\r
+ return false;\r
+ \r
$descr = $entity->description;\r
$title = $entity->title;\r
$owner = $entity->getOwnerEntity();\r
- return sprintf(elgg_echo('album:river:created'), $owner->name) . ' ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();\r
+ return sprintf(elgg_echo('album:river:created'), $owner->name) . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();\r
}\r
return null;\r
}\r