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