Here's what I'm trying to do. This is the function in the controller
public function get_started()
{
    if(test_login($this->session->all_userdata())) {
        $this->load->view('template');
    } else {
        $this->load->view('error');
    }
}
This is the helper
function test_login($sessdata)
{
    if($sessdata->userdata('is_logged_in')) {
        return true;
    } else {
        return false;
    }
}
I have entered is_logged_in as a boolean session variable.
However, this doesn't work.
I can't find the error.
instead of passing session data as parameter to your helper, you could access the session from helper itself, like:
function test_login() {
  $CI = & get_instance();  //get instance, access the CI superobject
  $isLoggedIn = $CI->session->userdata('is_logged_in');
  if( $isLoggedIn ) {
     return TRUE;
  }
  return FALSE;  
}
And controller:
public function get_started(){
   if( test_login() ) {
      $this->load->view('template');
   }
   else {
      $this->load->view('error');
   }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With