本文整理汇总了PHP中UserPeer::loadUserByUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::loadUserByUsername方法的具体用法?PHP UserPeer::loadUserByUsername怎么用?PHP UserPeer::loadUserByUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::loadUserByUsername方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setError
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);
if ($newUser) {
$subject = "Account details for " . SITE_CONFIG_SITE_NAME;
$plainMsg = "Dear " . $firstname . ",\n\n";
$plainMsg .= "Your account on " . SITE_CONFIG_SITE_NAME . " has be created. Use the details below to login to your new account:\n\n";
$plainMsg .= "<strong>Url:</strong> <a href='" . WEB_ROOT . "'>" . WEB_ROOT . "</a>\n";