getSubtype() == "news" && $news->canEdit()) { // Get owning user $owner = get_entity($news->getOwner()); // Delete it! $rowsaffected = $news->delete(); if ($rowsaffected > 0) { delete_data("DELETE from {$CONFIG->dbprefix}koolielu_calendar_objects where guid=".$guid); // Success message /*translation:News deleted.*/ system_message(elgg_echo("koolielu:message_news_deleted")); // No need to tell about images being deleted deleteKeObjectImages($guid, $owner->getGUID()); } else { /*translation:News could not be deleted.*/ register_error(elgg_echo("koolielu:error_news_not_deleted")); } // Forward to the main page forward($CONFIG->wwwroot . "pg/info/news"); } ?>