Elgg  Version 4.3
resetpassword.php
Go to the documentation of this file.
1 <?php
14 $guid = (int) get_input('guid');
16 
17 if (!$user || !$user->canEdit()) {
18  return elgg_error_response(elgg_echo('admin:user:resetpassword:no'));
19 }
20 
22 
23 $user->setPassword($password);
24 
25 notify_user($user->guid,
26  elgg_get_site_entity()->guid,
27  elgg_echo('email:resetpassword:subject', [], $user->language),
28  elgg_echo('email:resetpassword:body', [$password], $user->language),
29  [
30  'object' => $user,
31  'action' => 'resetpassword',
32  'password' => $password,
33  'apply_muting' => false,
34  ],
35  'email');
36 
37 return elgg_ok_response('', elgg_echo('admin:user:resetpassword:yes'));
$user
get_user($guid)
Get a user object from a GUID.
Definition: users.php:20
elgg_generate_password()
Generate a random 12 character clear text password.
Definition: users.php:91
$guid
Reset a user&#39;s password.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
notify_user($to, $from=0, $subject= '', $message= '', array $params=[], $methods_override=null)
Notify a user via their preferences.
if(!$user||!$user->canEdit()) $password
get_input($variable, $default=null, $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_get_site_entity()
Get the current site entity.
Definition: entities.php:99
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.