Elgg  Version 4.3
Go to the documentation of this file.
1 <?php
6 $guid = (array) get_input('guid');
7 if (empty($guid)) {
8  return elgg_error_response(elgg_echo('error:missing_data'));
9 }
12 if (!$user || !$user->canEdit()) {
13  return elgg_error_response(elgg_echo('admin:user:makeadmin:no'));
14 }
16 if (!$user->makeAdmin()) {
17  return elgg_error_response(elgg_echo('admin:user:makeadmin:no'));
18 }
20 return elgg_ok_response('', elgg_echo('admin:user:makeadmin:yes'));
Get a user object from a GUID.
Definition: users.php:20
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
if(empty($guid)) $user
Definition: makeadmin.php:11
get_input($variable, $default=null, $filter_result=true)
Parameter input functions.
Definition: input.php:20
Grants admin privileges to a user.
Definition: makeadmin.php:6
elgg_error_response($message= '', $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_ok_response($content= '', $message= '', $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.