本文整理汇总了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);
}