Elgg  Version master
delete.php
Go to the documentation of this file.
1 <?php
6 $id = (int) get_input('id');
7 
8 $items = elgg_get_river(['id' => $id]);
9 if (!$items) {
10  return elgg_error_response(elgg_echo('river:delete:fail'));
11 }
12 
14 if (!$item->canDelete()) {
15  return elgg_error_response(elgg_echo('river:delete:lack_permission'));
16 }
17 
18 if (!$item->delete()) {
19  return elgg_error_response(elgg_echo('river:delete:fail'));
20 }
21 
22 return elgg_ok_response('', elgg_echo('river:delete:success'));
if(!$items) $item
Definition: delete.php:13
elgg_ok_response($content= '', string|array $message= '', string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
$items
Definition: delete.php:8
elgg_error_response(string|array $message= '', string $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
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:101
$id
Generic annotation delete action.
Definition: delete.php:6