Welcome Guest, Not a member yet? Register   Sign In
how can I access a session variable inside a helper function?
#1

[eluser]zrowcrypt[/eluser]
I dont want to pass $user_id (= $this->session->userdata('user_id')) to each and every helper function that requires the logged in user id for processing... how can i access a session variable inside these functions.
#2

[eluser]WanWizard[/eluser]
You can access the CI superobject by using
Code:
// get the superobject
$CI =& get_instance();

// call the session library
$userid = $CI->session->userdata('user_id');




Theme © iAndrew 2016 - Forum software by © MyBB