• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I access session->user_id using a post_controller_constructor hook?

#1
[eluser]bigmike7801[/eluser]
I want to be able to get the user_id to use in a post_controller_constructor hook but I am getting an error
Quote:Message: Undefined property: CI_Session::$user_id
.

Here's my code
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class CheckProfile {
private $CI;

public function __construct(){
  $this->CI =& get_instance();
  $this->CI->load->library('session');
  $this->CI->load->model('contractor/contractor_m');
}
    
function is_profile_complete(){
     if($this->CI->contractor_m->profile_check($this->CI->session->user_id) == TRUE){
   $this->CI->session->set_userdata('profile_complete', TRUE);
  }else{
   $this->CI->session->set_userdata('profile_complete', TRUE);
  }
  
  $this->CI->session->set_userdata('profile_test', "test worked");
}
}

#2
[eluser]InsiteFX[/eluser]
Try loading the database, because the last thing CodeIgniter doe's is close any open database's

See the last line in ./system/core/codeigniter.php


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.