function shoutout_delete($guid) { $shoutout = get_entity($guid); if (!elgg_instanceof($shoutout, 'object', 'shoutout')) { return FALSE; } // delete attachments $attachments = elgg_get_annotations(array('guid' => $guid, 'annotation_name' => 'shoutout_attachment')); if ($attachments) { foreach ($attachments as $a) { list($time_bit, $ofn) = explode("|", $a->value); shoutout_attach_delete($a->owner_guid, $time_bit, $ofn); } } return $shoutout->delete(); }
<?php elgg_load_library('elgg:shoutout'); $guid = get_input('guid'); $time_bit = get_input('time_bit'); $ofn = get_input('filename'); if (elgg_is_admin_logged_in() || elgg_get_logged_in_user() == $guid) { shoutout_attach_delete($guid, $time_bit, $ofn); } exit;