本文整理汇总了PHP中UserPeer::getUserFromNickname方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::getUserFromNickname方法的具体用法?PHP UserPeer::getUserFromNickname怎么用?PHP UserPeer::getUserFromNickname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::getUserFromNickname方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toggleAdministrator
private function toggleAdministrator($administrator)
{
$user = UserPeer::getUserFromNickname($this->getRequestParameter('nickname'));
$this->forward404Unless($user);
$user->setIsAdministrator($administrator);
$user->save();
$this->redirect($this->getRequest()->getReferer());
}
示例2: executeShowSubscriber
public function executeShowSubscriber()
{
if ($this->hasRequestParameter('nickname')) {
$this->subscriber = UserPeer::getUserFromNickname($this->getRequestParameter('nickname'));
} else {
$this->subscriber = $this->getUser()->getSubscriber();
}
$this->forward404Unless($this->subscriber);
// $this->setShowVars();
}
示例3: executeAdd
public function executeAdd()
{
if ($this->getRequest()->getMethod() == sfRequest::POST) {
if (!$this->getRequestParameter('body')) {
return sfView::NONE;
}
$question = QuestionPeer::retrieveByPk($this->getRequestParameter('question_id'));
$this->forward404Unless($question);
// user or anonymous coward
$user = $this->getUser()->isAuthenticated() ? $this->getUser()->getSubscriber() : UserPeer::getUserFromNickname('anonymous');
// create answer
$this->answer = new Answer();
$this->answer->setQuestion($question);
$this->answer->setBody($this->getRequestParameter('body'));
$this->answer->setUser($user);
$this->answer->save();
return sfView::SUCCESS;
}
$this->forward404();
}