From 27781e0d8e226b89988e2cf7b8351d1d50cef4b7 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 17 May 2009 21:46:22 +0000 Subject: added events to end of successful actions so plugins can do stuff --- actions/addalbum.php | 3 +++ actions/delete.php | 5 +++-- actions/edit.php | 9 +++++++-- actions/upload.php | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/addalbum.php b/actions/addalbum.php index 3e7a12e87..329ebee48 100644 --- a/actions/addalbum.php +++ b/actions/addalbum.php @@ -64,6 +64,9 @@ unset($_SESSION['tidypicsbody']); unset($_SESSION['tidypicstags']); + // plugins can register to be told when a new Tidypics album has been created + trigger_elgg_event('add', 'tp_album', $album); + forward("pg/photos/upload/" . $album->guid); } diff --git a/actions/delete.php b/actions/delete.php index 5c275003e..ecc5f7ffe 100644 --- a/actions/delete.php +++ b/actions/delete.php @@ -16,7 +16,8 @@ $subtype = $photoObject->getSubtype(); $container = get_entity($photoObject->container_guid); - if ($subtype!='image' && $subtype!='album') forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //back off if not an album or image + if ($subtype!='image' && $subtype!='album') + forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //back off if not an album or image if ($subtype == 'image') { //deleting an image $forward_url = $container->getURL(); //forward back to album after deleting pictures @@ -93,7 +94,7 @@ } //end of canEdit() comparison } else { // unable to get Elgg entity - register_error(elgg_echo("file:deletefailed")); + register_error(elgg_echo("file:deletefailed")); } //end of get_entitty() forward($forward_url); diff --git a/actions/edit.php b/actions/edit.php index 5eab8caff..359e83fb0 100644 --- a/actions/edit.php +++ b/actions/edit.php @@ -65,10 +65,15 @@ } // Success message - if ($subtype == 'album') + if ($subtype == 'album') { system_message(elgg_echo("album:edited")); - else + // plugins can register to be told when a Tidypics album has been updated + trigger_elgg_event('update', 'tp_album', $entity); + } else { system_message(elgg_echo('images:edited')); + // plugins can register to be told when a Tidypics image has been updated + trigger_elgg_event('update', 'tp_album', $entity); + } forward($entity->getURL()); ?> diff --git a/actions/upload.php b/actions/upload.php index 7c50b95d4..90711704a 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -216,7 +216,9 @@ add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid); $album->new_album = 0; } - + // plugins can register to be told when a Tidypics album has had images added + trigger_elgg_event('upload', 'tp_album', $album); + forward($CONFIG->wwwroot . 'mod/tidypics/edit_multi.php?files=' . implode('-', $uploaded_images)); //forward to multi-image edit page } else { forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //upload failed, so forward to previous page -- cgit v1.2.3