Elgg  Version 1.11
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&#39;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
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
if(strpos($username, '@')!==false &&($users=get_user_by_email($username))) $user
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
get_user_by_username($username)
Get user by username.
Definition: users.php:98
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$users
Definition: newest.php:3
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383