Elgg  Version 6.1
resetpassword.php
Go to the documentation of this file.
1 <?php
14 $guid = (int) get_input('guid');
15 
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->getLanguage()),
28  elgg_echo('email:resetpassword:body', [$password], $user->getLanguage()),
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
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_generate_password()
Generate a random 12 character clear text password.
Definition: users.php:134
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$guid
Reset a user&#39;s password.
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
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.
if(!$user||!$user->canEdit()) $password
elgg_get_site_entity()
Get the current site entity.
Definition: entities.php:101
get_user(int $guid)
Elgg users Functions to manage multiple or single users in an Elgg install.
Definition: users.php:16
notify_user(int|array $to, int $from=0, string $subject= '', string $message= '', array $params=[], $methods_override=null)
Notify a user via their preferences.