CodeIgniter Forums

Full Version: Unable to locate the specified class: Session.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have created a hook
$hook['pre_controller'] = array(
        'class'    => 'AdminAuthorization',
        'function' => 'isAuthorize',
        'filename' => 'AdminAuthorization.php',
        'filepath' => 'hooks',
        'params'   => []

My hook File AdminAuthorization.php
class AdminAuthorization extends CI_Controller
    public function __construct()
    public function isAuthorize(array $params)
        $classes    =    ["administrator"];
            //Check if user is logged in or not
            $user    =    $this->session->get_userdata("user");
            if(isset($user["user_group"]) && $user["user_group"] == "2")
                //Redirect to the dashboard page
                //Redirect to the login page
                if($this->router->method != "login")

My autoload.php file
$autoload['libraries'] = array('session','database','email');

Still I am getting the error Unable to locate the specified class: Session.php
Help me if I am doing anything wrong???
Looks like your hook structure is wrong try this one:

PHP Code:
$hook['pre_controller'][] = array(
       'class'    => 'AdminAuthorization',
       'function' => 'isAuthorize',
       'filename' => 'AdminAuthorization.php',
       'filepath' => 'hooks',
       'params'   => array()

You may also need to use a post_controller hook.
Load session library by autoload file

$autoload['libraries'] = array('database', 'session', 'form_validation','upload','recaptcha');
You do know that this thread is over 2 months old right?
I am having same issue... please i need help urgently