diff options
author | Sem <sembrestels@riseup.net> | 2011-11-06 01:30:19 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2011-11-06 01:30:19 +0100 |
commit | c2a680f932b589ada25a5c4c95523ffe07976b79 (patch) | |
tree | a00bef321918ea9cd567a3a4759805ab16912e08 /actions/videolist/delete.php | |
parent | d7ac68a7db932618c051442210614b9b6484c702 (diff) | |
download | elgg-c2a680f932b589ada25a5c4c95523ffe07976b79.tar.gz elgg-c2a680f932b589ada25a5c4c95523ffe07976b79.tar.bz2 |
Reordered actions (deleted some).
Diffstat (limited to 'actions/videolist/delete.php')
-rw-r--r-- | actions/videolist/delete.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/actions/videolist/delete.php b/actions/videolist/delete.php new file mode 100644 index 000000000..221109ec4 --- /dev/null +++ b/actions/videolist/delete.php @@ -0,0 +1,33 @@ +<?php +/** + * Elgg Videolist Plugin - + * This plugin allows users to delete videos + * + * @package Elgg + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Prateek Choudhary <synapticfield@gmail.com> + * @copyright Prateek Choudhary + */ +// Make sure we're logged in (send us to the front page if not) +gatekeeper(); + +// Get input data +$guid = (int) get_input('video'); + +// Make sure we actually have permission to edit +$video = get_entity($guid); +if ($video->getSubtype() == "videolist" && $video->canEdit()) { + // Get owning user + $owner = get_entity($video->getOwner()); + + // Delete it! + $rowsaffected = $video->delete(); + if ($rowsaffected > 0) { + // Success message + system_message(elgg_echo("videos:deleted")); + } else { + register_error(elgg_echo("videos:notdeleted")); + } + // Forward to the main video list page + forward($_SERVER['HTTP_REFERER']); +}
\ No newline at end of file |