當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserAccount::usernameExists方法代碼示例

本文整理匯總了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'));
     }
 }
開發者ID:7thZoneTechnology,項目名稱:hrms-1,代碼行數:38,代碼來源:ProfileController.php

示例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';
     }
 }
開發者ID:7thZoneTechnology,項目名稱:hrms-1,代碼行數:17,代碼來源:SignupController.php


注:本文中的UserAccount::usernameExists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。