本文整理汇总了PHP中send_confirmation_email函数的典型用法代码示例。如果您正苦于以下问题:PHP send_confirmation_email函数的具体用法?PHP send_confirmation_email怎么用?PHP send_confirmation_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_confirmation_email函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object
* @param boolean $notify print notice with link and terminate
*/
function user_signup($user, $notify = true)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/user/profile/lib.php';
$user->password = hash_internal_user_password($user->password);
$user->id = $DB->insert_record('user', $user);
/// Save any custom profile field information
profile_save_data($user);
$user = $DB->get_record('user', array('id' => $user->id));
events_trigger('user_created', $user);
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth_email');
}
if ($notify) {
global $CFG, $PAGE, $OUTPUT;
$emailconfirm = get_string('emailconfirm');
$PAGE->navbar->add($emailconfirm);
$PAGE->set_title($emailconfirm);
$PAGE->set_heading($PAGE->course->fullname);
echo $OUTPUT->header();
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例2: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object (with system magic quotes)
* @param boolean $notify print notice with link and terminate
*/
function user_signup($user, $notify = true)
{
global $CFG;
require_once $CFG->dirroot . '/user/profile/lib.php';
$user->password = hash_internal_user_password($user->password);
if (!($user->id = insert_record('user', $user))) {
print_error('auth_emailnoinsert', 'auth');
}
/// Save any custom profile field information
profile_save_data($user);
$user = get_record('user', 'id', $user->id);
events_trigger('user_created', $user);
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth');
}
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
$navlinks = array();
$navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($emailconfirm, $emailconfirm, $navigation);
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例3: send_confirm_email_again
function send_confirm_email_again($cust_email)
{
global $connection;
$max_mail_limit = 5;
$confirmEmailQuery = 'SELECT * ';
$confirmEmailQuery .= 'FROM customers ';
$confirmEmailQuery .= 'WHERE `customers`.`email` = "' . $cust_email . '";';
$confirmEmailResult = mysqli_query($connection, $confirmEmailQuery);
checkQuery($confirmEmailResult);
while ($result = mysqli_fetch_assoc($confirmEmailResult)) {
$confirmation_email_sent = $result["confirmation_email_sent"];
$name_first = $result["name_first"];
$name_last = $result["name_last"];
$hashed_con_number = $result["hashed_con_number"];
}
if ($confirmation_email_sent < $max_mail_limit) {
// incrementing the confirmation email sent number
$confirmation_email_sent++;
$customerQuery = 'UPDATE customers SET ';
$customerQuery .= 'confirmation_email_sent = ' . $confirmation_email_sent . ' ';
$customerQuery .= 'WHERE `customers`.`email` = "' . $cust_email . '" ';
$customerQuery .= 'LIMIT 1;';
$customerResult = mysqli_query($connection, $customerQuery);
checkQuery($customerResult);
send_confirmation_email($name_first, $name_last, $cust_email, $hashed_con_number);
return true;
} else {
return false;
}
}
示例4: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object (with system magic quotes)
* @param boolean $notify print notice with link and terminate
*/
function user_signup($user, $notify = true)
{
$user->password = hash_internal_user_password($user->password);
if (!($user->id = insert_record('user', $user))) {
print_error('auth_emailnoinsert', 'auth');
}
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth');
}
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
print_header($emailconfirm, $emailconfirm, $emailconfirm);
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例5: user_signup
function user_signup($user, $notify = true)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/user/profile/lib.php';
$password_clear = $user->password;
$user->password = hash_internal_user_password($user->password);
if (!($user->id = $DB->insert_record('user', $user))) {
print_error('auth_emailnoinsert', 'auth');
}
/// Save any custom profile field information
profile_save_data($user);
$conditions = array('id' => $user->id);
$user = $DB->get_record('user', $conditions);
/* Create user in Joomla */
$userinfo['username'] = $user->username;
$userinfo['password'] = $password_clear;
$userinfo['password2'] = $password_clear;
$userinfo['name'] = $user->firstname . " " . $user->lastname;
$userinfo['email'] = $user->email;
$userinfo['block'] = 1;
$this->call_method("createUser", $userinfo);
events_trigger('user_created', $user);
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth');
}
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
$navlinks = array();
$navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($emailconfirm, $emailconfirm, $navigation);
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例6: user_having_email
$error = null;
$sent = null;
$attemptedToSendEmail = false;
if (!$email && ($password_request || $confirmation_request)) {
$error = 'invalidemail';
} else {
if ($email) {
$data = user_having_email($email);
$username = $data['uname'];
if (!$data['uname']) {
$error = 'nouser';
} elseif ($password_request && $data['active']) {
$sent = send_account_email($email, $data);
$attemptedToSendEmail = true;
} else {
// Confirmation request.
if ($data['confirmed']) {
$error = 'alreadyconfirmed';
} else {
$attemptedToSendEmail = true;
$sent = send_confirmation_email($email, $data);
}
}
}
}
if ($attemptedToSendEmail && !$sent) {
$error = 'emailfail';
}
$body_classes = 'account-issues';
display_page('account_issues.tpl', 'Account Problems', get_certain_vars(get_defined_vars(), array('data')), array('quickstat' => false));
}
示例7: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object
* @param boolean $notify print notice with link and terminate
*/
function user_signup($user, $notify=true) {
global $CFG, $DB, $PAGE, $OUTPUT;
require_once($CFG->dirroot.'/user/profile/lib.php');
if ($this->user_exists($user->username)) {
print_error('auth_ldap_user_exists', 'auth_ldap');
}
$plainslashedpassword = $user->password;
unset($user->password);
if (! $this->user_create($user, $plainslashedpassword)) {
print_error('auth_ldap_create_error', 'auth_ldap');
}
$user->id = $DB->insert_record('user', $user);
// Save any custom profile field information
profile_save_data($user);
$this->update_user_record($user->username);
update_internal_user_password($user, $plainslashedpassword);
$user = $DB->get_record('user', array('id'=>$user->id));
events_trigger('user_created', $user);
if (! send_confirmation_email($user)) {
print_error('noemail', 'auth_ldap');
}
if ($notify) {
$emailconfirm = get_string('emailconfirm');
$PAGE->set_url('/auth/ldap/auth.php');
$PAGE->navbar->add($emailconfirm);
$PAGE->set_title($emailconfirm);
$PAGE->set_heading($emailconfirm);
echo $OUTPUT->header();
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例8: user_signup
function user_signup($user, $notify = true)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/user/profile/lib.php';
$password_clear = $user->password;
$user->password = hash_internal_user_password($user->password);
if (!($user->id = $DB->insert_record('user', $user))) {
print_error('auth_emailnoinsert', 'auth');
}
/// Save any custom profile field information
profile_save_data($user);
$conditions = array('id' => $user->id);
$user = $DB->get_record('user', $conditions);
/* Create user in Joomla */
$userinfo['username'] = $user->username;
$userinfo['password'] = $password_clear;
$userinfo['password2'] = $password_clear;
$userinfo['name'] = $user->firstname . " " . $user->lastname;
$userinfo['firstname'] = $user->firstname;
$userinfo['lastname'] = $user->lastname;
$userinfo['email'] = $user->email;
$userinfo['block'] = 1;
\core\event\user_created::create_from_userid($user->id)->trigger();
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth');
}
if ($notify) {
$emailconfirm = get_string('emailconfirm');
$PAGE->set_url('/auth/joomdle/auth.php');
$PAGE->navbar->add($emailconfirm);
$PAGE->set_title($emailconfirm);
$PAGE->set_heading($emailconfirm);
echo $OUTPUT->header();
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例9: test_generate_confirmation_link_with_custom_admin
/**
* Test generate_confirmation_link with custom admin link
*/
public function test_generate_confirmation_link_with_custom_admin()
{
global $CFG;
$this->resetAfterTest();
$sink = $this->redirectEmails();
$admin = $CFG->admin;
$CFG->admin = 'custom/admin/path';
$user = $this->getDataGenerator()->create_user(["username" => "many_-.@characters@_@-..-..", "confirmed" => false, "email" => 'test@example.com']);
$confirmationurl = "/admin/test.php?with=params";
$expected = $CFG->wwwroot . "/" . $CFG->admin . "/test.php?with=params&data=/many_-%2E%40characters%40_%40-%2E%2E-%2E%2E";
send_confirmation_email($user, $confirmationurl);
$sink->close();
$messages = $sink->get_messages();
$message = array_shift($messages);
$messagebody = quoted_printable_decode($message->body);
$sink->close();
$this->assertContains($expected, $messagebody);
$CFG->admin = $admin;
}
示例10: process_signup_form
function process_signup_form($target_page = 'index.php')
{
global $label;
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$CompName = $_POST['CompName'];
$Username = $_POST['Username'];
$Password = md5($_POST['Password']);
$Password2 = md5($_POST['Password2']);
$Email = $_POST['Email'];
$Newsletter = $_POST['Newsletter'];
$Notification1 = $_POST['Notification1'];
$Notification2 = $_POST['Notification2'];
$Aboutme = $_POST['Aboutme'];
$lang = $_POST['lang'];
if ($_REQUEST['lang'] == '') {
$lang = 'EN';
}
$error = validate_signup_form();
if ($error != '') {
echo "<span class='error_msg_label'>" . $label["advertiser_signup_error"] . "</span><P>";
echo "<span ><b>" . $error . "</b></span>";
$password = $_REQUEST['password'];
$password2 = $_REQUEST['password2'];
return false;
// error processing signup/
} else {
//$target_page="index.php";
$success = create_new_account($_SERVER['REMOTE_ADDR'], $FirstName, $LastName, $CompName, $Username, $_REQUEST['Password'], $Email, $Newsletter, $Notification1, $Notification2, $lang);
if (EM_NEEDS_ACTIVATION == "AUTO") {
$label["advertiser_signup_success_1"] = stripslashes(str_replace("%FirstName%", $FirstName, $label["advertiser_signup_success_1"]));
$label["advertiser_signup_success_1"] = stripslashes(str_replace("%LastName%", $LastName, $label["advertiser_signup_success_1"]));
$label["advertiser_signup_success_1"] = stripslashes(str_replace("%SITE_NAME%", SITE_NAME, $label["advertiser_signup_success_1"]));
$label["advertiser_signup_success_1"] = stripslashes(str_replace("%SITE_CONTACT_EMAIL%", SITE_CONTACT_EMAIL, $label["advertiser_signup_success_1"]));
echo $label["advertiser_signup_success_1"];
} else {
$label["advertiser_signup_success_2"] = stripslashes(str_replace("%FirstName%", $FirstName, $label["advertiser_signup_success_2"]));
$label["advertiser_signup_success_2"] = stripslashes(str_replace("%LastName%", $LastName, $label["advertiser_signup_success_2"]));
$label["advertiser_signup_success_2"] = stripslashes(str_replace("%SITE_NAME%", SITE_NAME, $label["advertiser_signup_success_2"]));
$label["advertiser_signup_success_2"] = stripslashes(str_replace("%SITE_CONTACT_EMAIL%", SITE_CONTACT_EMAIL, $label["advertiser_signup_success_2"]));
echo $label["advertiser_signup_success_2"];
//echo "<center>".$label["advertiser_signup_goback"]."</center>";
send_confirmation_email($Email);
}
echo "<center><form method='post' action='login.php?target_page=" . $target_page . "'><input type='hidden' name='Username' value='" . $_REQUEST['Username'] . "' > <input type='hidden' name='Password' value='" . $_REQUEST['Password'] . "'><input type='submit' value='" . $label["advertiser_signup_continue"] . "'></form></center>";
return true;
}
// end everything ok..
}
示例11: session_start
// --------------------------------------------
}
}
// ----------
session_start();
// Connect to a authenticated session
sessionAuthenticate(S_SHOWCART);
// Check the correct parameters have been passed
if (!isset($_GET["cust_id"]) || !isset($_GET["order_id"])) {
$_SESSION["message"] = "Incorrect parameters to order-step4.php";
header("Location: " . S_SHOWCART);
exit;
}
// Check this customer matches the $cust_id
$connection = DB::connect($dsn, true);
if (DB::isError($connection)) {
trigger_error($connection->getMessage(), E_USER_ERROR);
}
$cust_id = pearclean($_GET, "cust_id", 5, $connection);
$order_id = pearclean($_GET, "order_id", 5, $connection);
$real_cust_id = getCust_id($_SESSION["loginUsername"]);
if ($cust_id != $real_cust_id) {
$_SESSION["message"] = "You can only view your own receipts!";
header("Location: " . S_HOME);
exit;
}
// Send the user a confirmation email
send_confirmation_email($cust_id, $order_id, $connection);
// Redirect to a receipt page (this can't be the receipt page,
// since the reload problem would cause extra emails).
header("Location: " . S_ORDERRECEIPT . "?cust_id={$cust_id}&order_id={$order_id}");
示例12: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object
* @param boolean $notify print notice with link and terminate
*/
public function user_signup($user, $notify = true)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/user/profile/lib.php';
require_once $CFG->dirroot . '/user/lib.php';
$plainpassword = $user->password;
$user->password = hash_internal_user_password($user->password);
$user->mnethostid = $CFG->mnet_localhost_id;
if (empty($user->secret)) {
$user->secret = '';
}
if (empty($user->calendartype)) {
$user->calendartype = $CFG->calendartype;
}
$firstname = strtolower($user->firstname);
$lastname = strtolower($user->lastname);
$initials = $firstname[0] . $lastname[0];
try {
$transaction = $DB->start_delegated_transaction();
do {
$username = sprintf($initials . "%04d", rand(1, 9999));
} while ($DB->get_record('user', array("username" => $username), 'id', IGNORE_MISSING));
$user->username = $username;
$userdetailstext = "Username: {$username}<br />Password: {$plainpassword}";
$user->id = user_create_user($user, false, false);
user_add_password_history($user->id, $plainpassword);
// Save any custom profile field information.
$user->profile_field_typeofaccount = empty($user->profile_field_typeofaccount) ? 'student' : $user->profile_field_typeofaccount;
$user->profile_field_yearlevel = empty($user->profile_field_yearlevel) ? 'N/A' : $user->profile_field_yearlevel;
$user->profile_field_yearofbirth = empty($user->profile_field_yearofbirth) ? 'N/A' : $user->profile_field_yearofbirth;
$user->profile_field_whereareyoufrom = empty($user->profile_field_whereareyoufrom) ? 'Perth' : $user->profile_field_whereareyoufrom;
profile_save_data($user);
$record = new stdClass();
$record->studentuserid = $user->id;
$record->teacheruserid = $user->id;
switch ($user->profile_field_typeofaccount) {
case 'wceteacher':
$this->add_teacher($user->id);
break;
case 'adult':
case 'student':
default:
$this->add_student($user->id);
break;
}
// Trigger event.
\core\event\user_created::create_from_userid($user->id)->trigger();
// Assuming the both inserts work, we get to the following line.
$transaction->allow_commit();
} catch (Exception $e) {
$transaction->rollback($e);
return false;
}
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail, auth_email');
}
if ($notify) {
global $CFG, $PAGE, $OUTPUT;
$emailconfirm = get_string('emailconfirm');
$PAGE->navbar->add($emailconfirm);
$PAGE->set_title($emailconfirm);
$PAGE->set_heading($PAGE->course->fullname);
echo $OUTPUT->header();
notice(get_string('signup:emailconfirmsent:text', 'auth_watercorped', $userdetailstext), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
示例13: database_prep
}
} else {
$subscribe_checkbox_ok = 0;
}
// Evaluate all oks
if ($submission_valid == 1 && $name_first_ok == 1 && $name_last_ok == 1 && $birth_day_ok === true && $birth_month_ok === true && $birth_year_ok === true && $phone_ok == 1 && $email_ok == 1 && $password1_ok == 1 && $password2_ok == 1 && $captcha_ok === true && $agree_checkbox_ok == 1) {
// Prep for database using mysqli_real_escape_string()
$name_first = database_prep($name_first);
$name_last = database_prep($name_last);
$phone = database_prep($phone);
$email = database_prep($email);
$hashed_password = password_hash($password1, PASSWORD_BCRYPT);
$hashed_con_number = password_hash(mt_rand(), PASSWORD_BCRYPT);
$hashed_con_number = substr($hashed_con_number, 7);
create_new_customer($name_first, $name_last, 0, 0, 0, $phone, $hashed_password, $email, $hashed_con_number, $subscribe_checkbox_ok);
send_confirmation_email($name_first, $name_last, $email, $hashed_con_number);
if (isset($_POST)) {
unset($_POST);
}
include "_connections/connection_close.php";
$location = 'confirm_email.php?action=new&email=' . $email;
redirect($location);
}
} else {
echo "Submission error!";
exit;
}
}
// end if $_POST submit is set
if (isset($_POST)) {
unset($_POST);
示例14: change_email
/**
* @param string $edit
* @param PDO $link
* @return bool
*/
function change_email($edit, $link)
{
$error = 0;
if (isset($_POST[$edit])) {
$_POST[$edit] = trim($_POST[$edit]);
}
$change = isset($_POST['edit']) ? $_POST['edit'] == $edit && ($error = parse_email($_POST[$edit])) === 0 ? true : false : false;
if ($change) {
if ($_POST[$edit] === $_SESSION['user_array']['email']) {
change($edit, $link);
return true;
}
}
if ($change) {
if ($_POST[$edit] === "") {
change($edit, $link);
$_SESSION['user_array']['confirmed_email'] = chr(0);
return true;
}
if (captcha_verify_word()) {
$sql = "SELECT user, email FROM confirmed_emails where email = :email";
$stmt = $link->prepare($sql);
$stmt->bindValue(':email', $_POST[$edit], PDO::PARAM_STR);
if ($stmt->execute() !== false && ($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
if ($row['user'] !== $_SESSION['user_array']['user']) {
$error = 3;
}
}
if (!$error) {
if (change($edit, $link)) {
send_confirmation_email($_POST[$edit], $link);
$_SESSION['user_array']['email'] = $_POST[$edit];
echo PR_EMAIL . ': ' . $_SESSION['user_array']['email'] . " ";
echo (ord($_SESSION['user_array']['hemail']) ? PR_HIDDEN : PR_VISIBLE) . " [<a href=\"profile.phtml?user=" . $_SESSION['user_array']['user'] . "&edit=email\">" . PR_EDIT . "</a>] <span style=color:red>" . PR_SENT_1_A . "</span><script type='text/javascript'>alert(\"" . PR_SENT_1 . "\\n" . PR_SENT_2 . "\")</script><br />" . PHP_EOL;
return false;
}
}
} else {
$error = 4;
}
}
echo "<form id=\"editForm\" method=\"POST\">" . PR_EMAIL . ": <input type=\"text\" id=\"" . $edit . "\" name=\"" . $edit . "\" value=\"" . $_SESSION['user_array'][$edit] . "\" onfocus=\"javascript:document.getElementById('focusId').value='" . $edit . "';\" />";
echo "<input type=\"hidden\" id=\"focusId\" name=\"focusId\" value=\"" . $edit . "\">" . PHP_EOL;
echo "<input type=\"hidden\" name=\"edit\" value=\"" . $edit . "\">" . PHP_EOL;
echo "<input type=\"hidden\" name=\"user\" value=\"" . $_SESSION['user_array']['user'] . "\">" . PHP_EOL;
echo "<input type=\"checkbox\" name=\"h" . $edit . "\" value=\"true\"";
if (ord($_SESSION['user_array']['h' . $edit])) {
echo " checked=\"checked\" ";
}
echo '/>' . PR_HIDE;
switch ($error) {
case 1:
echo "<span style=\"color:red\"> " . PR_ERR_MAIL_LONG . "</span><script type='text/javascript'>focusId='" . $edit . "'</script>";
break;
case 2:
echo "<span style=\"color:red\"> " . PR_ERR_MAIL_INVALID . "</span><script type='text/javascript'>focusId='" . $edit . "'</script>";
break;
case 3:
echo "<span style=\"color:red\"> " . PR_ERR_MAIL_ALREADY_ASSOC . "</span><script type='text/javascript'>focusId='" . $edit . "';document.getElementById('" . $edit . "').value='" . $_POST[$edit] . "';</script>";
break;
}
echo "<br /><span id=\"captchaImage\" style=\"border:0;width:140px;\"><img src=\"." . SYNAPP_CAPTCHA_PATH . "/captcha.image.php?nocache=" . hash("sha256", time() . mt_rand()) . "\" alt=\"captcha\"/></span><a \nhref=\"#\" onclick=\"updateCaptcha(null, '." . SYNAPP_CAPTCHA_PATH . "' );return false;\"><img src=\"." . SYNAPP_UI_RESOURCES_PATH . "/images/refresh.png\" style=\"border:0\" alt=\"" . PR_REFRESH . "\" title=\"" . PR_REFRESH . "\"/></a>";
echo "<br />" . PR_CAPT . "<input type=\"text\" id=\"magicword\" " . "onfocus=\"javascript:document.getElementById('focusId').value='magicword';\" name=\"magicword\" autocomplete=\"off\" />";
if ($error == 4) {
echo "<span style=\"color:red\"> " . PR_ERR_CAPT . "</span><script type='text/javascript'>" . "focusId='magicword';document.getElementById('" . $edit . "').value='" . $_POST[$edit] . "';</script>";
}
echo '<br /></form>' . PHP_EOL;
if (isset($_GET['alert']) && !count($_POST)) {
if ($_GET['alert'] === "true") {
echo "<script type='text/javascript'>alert(\"" . PR_VALIDATE_MAIL . "\")</script>";
}
}
return false;
}
示例15: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object
* @param boolean $notify print notice with link and terminate
* @return boolean success
*/
function user_signup($user, $notify = true)
{
global $CFG, $DB, $PAGE, $OUTPUT;
require_once $CFG->dirroot . '/user/profile/lib.php';
require_once $CFG->dirroot . '/user/lib.php';
if ($this->user_exists($user->username)) {
print_error('auth_ldap_user_exists', 'auth_ldap');
}
$plainslashedpassword = $user->password;
unset($user->password);
if (!$this->user_create($user, $plainslashedpassword)) {
print_error('auth_ldap_create_error', 'auth_ldap');
}
$user->id = user_create_user($user, false, false);
user_add_password_history($user->id, $plainslashedpassword);
// Save any custom profile field information
profile_save_data($user);
$this->update_user_record($user->username);
// This will also update the stored hash to the latest algorithm
// if the existing hash is using an out-of-date algorithm (or the
// legacy md5 algorithm).
update_internal_user_password($user, $plainslashedpassword);
$user = $DB->get_record('user', array('id' => $user->id));
\core\event\user_created::create_from_userid($user->id)->trigger();
if (!send_confirmation_email($user)) {
print_error('noemail', 'auth_ldap');
}
if ($notify) {
$emailconfirm = get_string('emailconfirm');
$PAGE->set_url('/auth/ldap/auth.php');
$PAGE->navbar->add($emailconfirm);
$PAGE->set_title($emailconfirm);
$PAGE->set_heading($emailconfirm);
echo $OUTPUT->header();
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}