本文整理汇总了PHP中UserPeer::loadUserByEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::loadUserByEmailAddress方法的具体用法?PHP UserPeer::loadUserByEmailAddress怎么用?PHP UserPeer::loadUserByEmailAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::loadUserByEmailAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (!strlen($firstname)) {
setError(t("please_enter_your_firstname", "Please enter your firstname"));
} elseif (!strlen($lastname)) {
setError(t("please_enter_your_lastname", "Please enter your lastname"));
} elseif (!strlen($emailAddress)) {
setError(t("please_enter_your_email_address", "Please enter your email address"));
} elseif ($emailAddress != $emailAddressConfirm) {
setError(t("your_email_address_confirmation_does_not_match", "Your email address confirmation does not match"));
} elseif (!valid_email($emailAddress)) {
setError(t("your_email_address_is_invalid", "Your email address is invalid"));
} elseif (!strlen($username)) {
setError(t("please_enter_your_preferred_username", "Please enter your preferred username"));
} elseif (strlen($username) < 6 || strlen($username) > 20) {
setError(t("username_must_be_between_6_and_20_characters", "Your username must be between 6 and 20 characters"));
} else {
$checkEmail = UserPeer::loadUserByEmailAddress($emailAddress);
if ($checkEmail) {
// username exists
setError(t("email_address_already_exists", "Email address already exists on another account"));
} else {
$checkUser = UserPeer::loadUserByUsername($username);
if ($checkUser) {
// username exists
setError(t("username_already_exists", "Username already exists on another account"));
}
}
}
// create the account
if (!isErrors()) {
$newPassword = createPassword();
$newUser = UserPeer::create($username, $newPassword, $emailAddress, $title, $firstname, $lastname);
示例2: trim
/* register user */
if ((int) $_REQUEST['submitme']) {
// validation
$emailAddress = trim(strtolower($_REQUEST['emailAddress']));
if (!strlen($emailAddress)) {
setError(t("please_enter_your_email_address", "Please enter the account email address"));
} else {
$checkEmail = UserPeer::loadUserByEmailAddress($emailAddress);
if (!$checkEmail) {
// username exists
setError(t("account_not_found", "Account with that email address not found"));
}
}
// create the account
if (!isErrors()) {
$userAccount = UserPeer::loadUserByEmailAddress($emailAddress);
if ($userAccount) {
// create password reset hash
$resetHash = UserPeer::createPasswordResetHash($userAccount->id);
$subject = "Password reset instructions for account on " . SITE_CONFIG_SITE_NAME;
$plainMsg = "Dear " . $userAccount->firstname . ",\n\n";
$plainMsg .= "We've a request to reset your password on " . SITE_CONFIG_SITE_NAME . ". Follow the url below to set a new account password:\n\n";
$plainMsg .= "<a href='" . WEB_ROOT . "/forgot_password_reset." . SITE_CONFIG_PAGE_EXTENSION . "?u=" . $userAccount->id . "&h=" . $resetHash . "'>" . WEB_ROOT . "/forgot_password_reset." . SITE_CONFIG_PAGE_EXTENSION . "?u=" . $userAccount->id . "&h=" . $resetHash . "</a>\n\n";
$plainMsg .= "If you didn't request a password reset, just ignore this email and your existing password will continue to work.\n\n";
$plainMsg .= "Regards,\n";
$plainMsg .= SITE_CONFIG_SITE_NAME . " Admin\n";
send_html_mail($emailAddress, $subject, str_replace("\n", "<br/>", $plainMsg), SITE_CONFIG_DEFAULT_EMAIL_ADDRESS_FROM, strip_tags($plainMsg));
redirect(WEB_ROOT . "/forgot_password." . SITE_CONFIG_PAGE_EXTENSION . "?s=1");
}
}
}