![]() |
My_Controller issue - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: My_Controller issue (/showthread.php?tid=22440) |
My_Controller issue - El Forum - 09-09-2009 [eluser]ericsodt[/eluser] So I am doing some filtering at the controller level. I am making sure that a regular user stays within the regular user section and the admins stay within the admin section. To do this, I extended the Controller and built some logic around it Code: function validate(){ Everything works fine except when I try and log an admin out. It sees that it is not in the admin section and is an admin, which then throws them back to where they were. I am just trying to pass any values to the Controller that would have been passed to the calling method. For example, to log out the url is "welcome/index". This checks to see if the user is logging out and if so completes this action. This method however will never get called because of My_Controller. I was thinking of passing a variable through it as so "welcome/index/logout" but I am having a hard time figuring out how My_Controller can see the parameter. Does anyone know how a Controller can capture what is being passed to the desired method? Thanks! My_Controller issue - El Forum - 09-09-2009 [eluser]bretticus[/eluser] Why not just have a separate controller method for logging out and not calling validate() on it? BTW: You can get the current controller with $this->router->class and you can get the current model with $this->router->method. You can get logout in welcome/index/logout via $this->uri->segment(3). My_Controller issue - El Forum - 09-09-2009 [eluser]ericsodt[/eluser] validate is to make sure that the admins can only access admin modules and 'regular' users can not access admin modules. [quote author="bretticus" date="1252545470"]Why not just have a separate controller method for logging out and not calling validate() on it?[/quote] My_Controller issue - El Forum - 09-09-2009 [eluser]bretticus[/eluser] [quote author="ericsodt" date="1252545591"]validate is to make sure that the admins can only access admin modules and 'regular' users can not access admin modules. [quote author="bretticus" date="1252545470"]Why not just have a separate controller method for logging out and not calling validate() on it?[/quote][/quote] Do you need to validate a log out??? BTW, I added some things to my original post. |