本文整理匯總了PHP中UserClass::getByEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserClass::getByEmail方法的具體用法?PHP UserClass::getByEmail怎麽用?PHP UserClass::getByEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserClass
的用法示例。
在下文中一共展示了UserClass::getByEmail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handler
function handler()
{
$messages = parent::handler();
if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
foreach ($this->_FORMDATA as $name => $value) {
if ($name == "email") {
$user = UserClass::getByEmail($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким email уже зарегистрирован";
}
} else {
if ($name == "login") {
$user = UserClass::getByLogin($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким логином уже зарегистрирован";
}
}
}
}
if ($error_message) {
$messages["status"] = "error";
$messages["error"] = $error_message;
unset($messages["success"]);
} else {
$arFields = array("login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => false, "code" => md5(date("Y-m-d H:i:s")));
UserClass::createUser($arFields);
$messages["success"] = "Спасибо за регистрацию. На Ваш email выслано письмо для активации аккаунта.";
MailController::RegisterMail($this->_FORMDATA["email"], $arFields["code"]);
}
}
return $messages;
}
示例2: handler
function handler()
{
$messages = parent::handler();
$_USER = UserClass::getById($this->_FORMDATA["id"]);
if ($messages["status"] == "success" && !empty($this->_FORMDATA)) {
foreach ($this->_FORMDATA as $name => $value) {
if ($name == "email" && $value != $_USER->getProperty("email")) {
$user = UserClass::getByEmail($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким email уже зарегистрирован";
}
} else {
if ($name == "login" && $value != $_USER->getProperty("login")) {
$user = UserClass::getByLogin($value);
if ($user !== false) {
$error_message[] = "Пользователь с таким логином уже зарегистрирован";
}
}
}
}
if ($error_message) {
$messages["status"] = "error";
$messages["error"] = $error_message;
unset($messages["success"]);
} else {
$arFields = array("id" => $this->_FORMDATA["id"], "login" => $this->_FORMDATA["login"], "email" => $this->_FORMDATA["email"], "full_name" => $this->_FORMDATA["full_name"], "pass" => $this->_FORMDATA["pass"], "active" => 1);
UserClass::updateUser($arFields);
$messages["success"] = "Информация обновлена.";
}
}
return $messages;
}