![]() |
Hook - Community Auth - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7) +--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13) +--- Thread: Hook - Community Auth (/showthread.php?tid=65757) |
Hook - Community Auth - harkor - 07-20-2016 Hello, I'm trying to use Community Auth on a fresh CodeIgniter install version 3.0.6. I follow all the installation guide but when I try to use, I have this message Code: A PHP Error was encountered The hook files are setup correctly and I configure the hooks.php in the config folder. If I try to add "echo 'test';" in the function auth_constants, nothing happend. Any idea ? RE: Hook - Community Auth - harkor - 07-20-2016 I found my miste... The hooks are disabled in config.php ![]() But I have another question, you use for example in your Examples controller, $this->require_role('admin'). How can I call the same function in another controller ? RE: Hook - Community Auth - skunkbad - 07-20-2016 LOGIN_PAGE is defined in the auth_constants hook, and it's a pre_system hook. In config/config you should set enable_hooks to TRUE. There is no magic here. Either auth_constants hook runs because it's set up correctly or not. Note installation step 5: 5) Copy auth_constants.php and auth_sess_check.php from community_auth/hooks to CodeIgniter's application/hooks directory. If these files are in your application/hooks directory, you've enabled hooks in config/config, and put the following in config/hooks.php, then it should work: Code: $hook['pre_system'] = array( RE: Hook - Community Auth - easymusic - 08-15-2016 I'm wondering the same thing he asked at the end Skunkbad "How can I call the same function in another controller ?" RE: Hook - Community Auth - skunkbad - 08-15-2016 (08-15-2016, 12:43 AM)easymusic Wrote: I'm wondering the same thing he asked at the end Skunkbad Instead of your controller class extending CI_Controller, just have it instead extend MY_Controller. That's it. RE: Hook - Community Auth - easymusic - 08-15-2016 (08-15-2016, 07:04 AM)skunkbad Wrote:Thanks skunk, haha your amazing, it worked. Thanks for all the hardwork (Community Auth) !(08-15-2016, 12:43 AM)easymusic Wrote: I'm wondering the same thing he asked at the end Skunkbad |