Elgg  Version 3.0
Go to the documentation of this file.
1 <?php
6 $id = (int) get_input('id');
8 $items = elgg_get_river(['id' => $id]);
9 if (!$items) {
10  return elgg_error_response(elgg_echo('river:delete:fail'));
11 }
14 if (!$item->canDelete()) {
15  return elgg_error_response(elgg_echo('river:delete:lack_permission'));
16 }
18 if (!$item->delete()) {
19  return elgg_error_response(elgg_echo('river:delete:fail'));
20 }
22 return elgg_ok_response('', elgg_echo('river:delete:success'));
if(!$items) $item
Definition: delete.php:13
Definition: delete.php:8
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
River item delete action.
Definition: delete.php:6
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
elgg_get_river(array $options=[])
Get river items.
Definition: river.php:184
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.