本文整理汇总了PHP中UserAccount::usernameExists方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::usernameExists方法的具体用法?PHP UserAccount::usernameExists怎么用?PHP UserAccount::usernameExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::usernameExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processchangeusernameAction
function processchangeusernameAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$session = SessionWrapper::getInstance();
$this->_translate = Zend_Registry::get("translate");
$formvalues = $this->_getAllParams();
if (!isArrayKeyAnEmptyString('username', $formvalues)) {
$user = new UserAccount();
$user->populate(decode($formvalues['id']));
// debugMessage($user->toArray());
if ($user->usernameExists($formvalues['username'])) {
$session->setVar(ERROR_MESSAGE, sprintf($this->_translate->translate("profile_username_unique_error"), $formvalues['username']));
return false;
}
# save new username
$user->setUsername($formvalues['username']);
$user->save();
$view = new Zend_View();
$url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
$usecase = '1.17';
$module = '1';
$type = USER_CHANGE_EMAIL;
$details = "Username for <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a> Changed";
$browser = new Browser();
$audit_values = $session->getVar('browseraudit');
$audit_values['module'] = $module;
$audit_values['usecase'] = $usecase;
$audit_values['transactiontype'] = $type;
$audit_values['userid'] = $session->getVar('userid');
$audit_values['url'] = $url;
$audit_values['transactiondetails'] = $details;
$audit_values['status'] = "Y";
// debugMessage($audit_values);
$this->notify(new sfEvent($this, $type, $audit_values));
$this->_redirect($this->view->baseUrl('index/profileupdatesuccess'));
}
}
示例2: checkusernameAction
function checkusernameAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$formvalues = $this->_getAllParams();
$username = trim($formvalues['username']);
// debugMessage($formvalues);
$user = new UserAccount();
if (!isArrayKeyAnEmptyString('userid', $formvalues)) {
$user->populate($formvalues['userid']);
}
if ($user->usernameExists($username)) {
echo '1';
} else {
echo '0';
}
}