Redirecting to admin's login page when accessing a module controller

edited June 2014 in Share
I am trying to access the index function of a module controller inheriting from Fuel_base_controller:

require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');

class Registeration extends Fuel_base_controller
{
function __construct()
{
parent::__construct();
}
function index()
{
}
...
But if I am not already logged in as admin, I will be redirected to the admin's login page which is not necessary. How can I prevent this?

Comments

  • edited June 2014
    I could find my answer here:
    http://forum.getfuelcms.com/discussion/18/building-a-form-with-radio-buttons/p1

    In the 1.0 beta, If you inherit from the Fuel_base_controller, there is a protected "_validate_user" method you can use which will validate if a person is logged in by using the Fuel_auth class (e.g. $this->fuel->auth->has_permission($permission)). By default, a controller inheriting from Fuel_base_controller will run that method unless you pass FALSE to the parent constructor.

    Hence my new code:
    function __construct()
    {
    parent::__construct(false);
    }
    The only question that remains now is that where has this info been documented? I could not find any description of the class in this page: http://docs.getfuelcms.com/libraries/fuel_base_controller
  • edited 10:40AM
    The documentation for that class is a bit thin. However, looking at the source code should be pretty helpful. It's found in fuel/modules/fuel/libraries/Fuel_base_controller.php
Sign In or Register to comment.