本文整理汇总了PHP中Conf::user_by_email方法的典型用法代码示例。如果您正苦于以下问题:PHP Conf::user_by_email方法的具体用法?PHP Conf::user_by_email怎么用?PHP Conf::user_by_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conf
的用法示例。
在下文中一共展示了Conf::user_by_email方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
static function create(Conf $conf, $reg, $send = false)
{
global $Me, $Now;
if (is_array($reg)) {
$reg = (object) $reg;
}
assert(is_string($reg->email));
$email = trim($reg->email);
assert($email !== "");
// look up account first
if ($acct = $conf->user_by_email($email)) {
return $acct;
}
// validate email, check contactdb
if (!get($reg, "no_validate_email") && !validate_email($email)) {
return null;
}
$cdbu = Contact::contactdb_find_by_email($email);
if (get($reg, "only_if_contactdb") && !$cdbu) {
return null;
}
$cj = (object) array();
foreach (array("firstName", "lastName", "email", "affiliation", "collaborators", "preferredEmail") as $k) {
if ($v = $cdbu && $cdbu->{$k} ? $cdbu->{$k} : get($reg, $k)) {
$cj->{$k} = $v;
}
}
if ($v = $cdbu && $cdbu->voicePhoneNumber ? $cdbu->voicePhoneNumber : get($reg, "voicePhoneNumber")) {
$cj->phone = $v;
}
if ($cdbu && $cdbu->disabled || get($reg, "disabled")) {
$cj->disabled = true;
}
$acct = new Contact();
if ($acct->save_json($cj, null, $send)) {
if ($Me && $Me->privChair) {
$type = $acct->disabled ? "disabled " : "";
$conf->infoMsg("Created {$type}account for <a href=\"" . hoturl("profile", "u=" . urlencode($acct->email)) . "\">" . Text::user_html_nolink($acct) . "</a>.");
}
return $acct;
} else {
$conf->log("Account {$email} creation failure", $Me);
return null;
}
}