本文整理匯總了PHP中UserHelper::setLoggedIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserHelper::setLoggedIn方法的具體用法?PHP UserHelper::setLoggedIn怎麽用?PHP UserHelper::setLoggedIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserHelper
的用法示例。
在下文中一共展示了UserHelper::setLoggedIn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: register
/**
* Called to register
*/
public function register()
{
$this->load->spark('robot-helper/1.1');
$this->load->helper('robot');
$this->load->helper('form');
$this->load->library('form_validation');
$submit = $this->input->post('submit');
if ($submit) {
if ($this->form_validation->run('registration')) {
$this->load->model('contributor');
$insert = elements(array('username', 'email', 'real_name', 'password', 'website'), $_POST);
if (Contributor::insert($insert)) {
UserHelper::setNotice("Yay! Start contributing sparks!");
UserHelper::setLoggedIn(Contributor::findByUsername($insert['username']));
UtilityHelper::handleRedirectIfNeeded();
redirect(base_url() . 'contributors/' . $insert['username'] . '/profile');
} else {
UserHelper::setNotice("Whoa. That didn't work. Sorry?", FALSE);
}
} else {
UserHelper::setNotice('Whoops. There were some errors. Check below and re-submit!');
}
}
list($question, $answer) = get_spam_check();
$data['spam_question'] = $question;
$data['spam_answer'] = $answer;
$this->load->view('contributors/register', $data);
}