本文整理汇总了PHP中Idno\Entities\User::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setTitle方法的具体用法?PHP User::setTitle怎么用?PHP User::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Idno\Entities\User
的用法示例。
在下文中一共展示了User::setTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postContent
//.........这里部分代码省略.........
if ($new_invitation->sendToEmail($email)) {
\Idno\Core\site()->session()->addMessage("The invitation was resent.");
}
}
}
break;
case 'add_user':
if (!\Idno\Core\site()->config()->canAddUsers()) {
\Idno\Core\site()->session()->addMessage("You can't add any more users to your site.");
break;
}
$name = $this->getInput('name');
$handle = trim($this->getInput('handle'));
$email = trim($this->getInput('email'));
$password = trim($this->getInput('password1'));
$password2 = trim($this->getInput('password2'));
$user = new \Idno\Entities\User();
if (empty($password) || $password != $password2) {
\Idno\Core\site()->session()->addMessage("Please make sure your passwords match and aren't empty.");
} else {
if (empty($handle) && empty($email)) {
\Idno\Core\site()->session()->addMessage("Please enter a username and email address.");
} else {
if (!empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!($emailuser = \Idno\Entities\User::getByEmail($email)) && !($handleuser = \Idno\Entities\User::getByHandle($handle)) && !empty($handle) && strlen($handle) <= 32 && !substr_count($handle, '/')) {
$user = new \Idno\Entities\User();
$user->email = $email;
$user->handle = strtolower(trim($handle));
// Trim the handle and set it to lowercase
$user->setPassword($password);
if (empty($name)) {
$name = $user->handle;
}
$user->setTitle($name);
$user->save();
} else {
if (empty($handle)) {
\Idno\Core\site()->session()->addMessage("Please create a username.");
}
if (strlen($handle) > 32) {
\Idno\Core\site()->session()->addMessage("Your username is too long.");
}
if (substr_count($handle, '/')) {
\Idno\Core\site()->session()->addMessage("Usernames can't contain a slash ('/') character.");
}
if (!empty($handleuser)) {
\Idno\Core\site()->session()->addMessage("Unfortunately, someone is already using that username. Please choose another.");
}
if (!empty($emailuser)) {
\Idno\Core\site()->session()->addMessage("Hey, it looks like there's already an account with that email address. Did you forget your login?");
}
}
} else {
\Idno\Core\site()->session()->addMessage("That doesn't seem like it's a valid email address.");
}
}
}
if (!empty($user->_id)) {
\Idno\Core\site()->session()->addMessage("User " . $user->getHandle() . " was created. You may wish to email them to let them know.");
} else {
\Idno\Core\site()->session()->addMessageAtStart("We couldn't register that user.");
}
break;
case 'block_emails':
$emails = $this->getInput('blocked_emails');
preg_match_all('/[a-z\\d._%+-]+@[a-z\\d.-]+\\.[a-z]{2,4}\\b/i', $emails, $matches);