Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
requestnewpassword.php
Go to the documentation of this file.
1 <?php
9 $username = get_input('username');
10 
11 // allow email addresses
12 if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
13  $username = $users[0]->username;
14 }
15 
17 if ($user) {
18  if (send_new_password_request($user->guid)) {
19  system_message(elgg_echo('user:password:changereq:success'));
20  } else {
21  register_error(elgg_echo('user:password:changereq:fail'));
22  }
23 } else {
24  register_error(elgg_echo('user:username:notfound', array($username)));
25 }
26 
27 forward();
send_new_password_request($user_guid)
Generate and send a password request email to a given user's registered email address.
Definition: users.php:153
get_user_by_email($email)
Get an array of users from an email address.
Definition: users.php:120
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
if(strpos($username, '@')!==false &&($users=get_user_by_email($username))) $user
get_user_by_username($username)
Get user by username.
Definition: users.php:98
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$users
Definition: newest.php:3
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
system_message($message)
Display a system message on next page load.
Definition: elgglib.php:438