Elgg  Version 2.3
upload.php
Go to the documentation of this file.
1 <?php
6 $guid = get_input('guid');
8 
9 if (!$owner || !($owner instanceof ElggUser) || !$owner->canEdit()) {
10  register_error(elgg_echo('avatar:upload:fail'));
12 }
13 
14 $error = elgg_get_friendly_upload_error($_FILES['avatar']['error']);
15 if ($error) {
18 }
19 
20 if (!$owner->saveIconFromUploadedFile('avatar')) {
21  register_error(elgg_echo('avatar:resize:fail'));
23 }
24 
25 if (elgg_trigger_event('profileiconupdate', $owner->type, $owner)) {
26  system_message(elgg_echo("avatar:upload:success"));
27 
28  $view = 'river/user/default/profileiconupdate';
29  _elgg_delete_river(array('subject_guid' => $owner->guid, 'view' => $view));
31  'view' => $view,
32  'action_type' => 'update',
33  'subject_guid' => $owner->guid,
34  'object_guid' => $owner->guid,
35  ));
36 }
37 
$view
Definition: crop.php:34
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $error
Definition: upload.php:14
$owner
Definition: upload.php:7
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
_elgg_delete_river(array $options=[])
Alias of elgg_delete_river() that doesn&#39;t raise notices.
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:425
elgg_get_friendly_upload_error($error_code)
Returns a human-readable message for PHP&#39;s upload error codes.
Definition: output.php:425
elgg_create_river_item(array $options=array())
Adds an item to the river.
Definition: river.php:39
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
const REFERER
Definition: elgglib.php:2123
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:390
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:399
elgg_trigger_event($event, $object_type, $object=null)
Definition: elgglib.php:614
$guid
Avatar upload action.
Definition: upload.php:6
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204