CodeIgniter Forums
Community Auth scope: need access when building page header - 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: Community Auth scope: need access when building page header (/showthread.php?tid=67587)



Community Auth scope: need access when building page header - imstarboard - 03-12-2017

I have successfully adapted Community Auth to use my forms.  Now I'm trying to access the auth functions and variables from a library class that builds my page for me so I can customize the header based on user and permissions.  Currently I am autoloading that class...

How can I load the class in such a way as to provide access to the auth resources?


RE: Community Auth scope: need access when building page header - skunkbad - 03-12-2017

i might need to know more. You are obviously routing to a controller, because that's just how CI works. It's always in the controller where you use the Auth functions. If the library is autoloaded, it can access the Auth variables through config. If you are attempting to do something in the class constructor of the library, I don't see how that would be reliable, but if you can explain your logic, maybe I can help.


RE: Community Auth scope: need access when building page header - imstarboard - 03-12-2017

(03-12-2017, 03:25 PM)skunkbad Wrote: i might need to know more. You are obviously routing to a controller, because that's just how CI works. It's always in the controller where you use the Auth functions. If the library is autoloaded, it can access the Auth variables through config. If you are attempting to do something in the class constructor of the library, I don't see how that would be reliable, but if you can explain your logic, maybe I can help.


>> SOLVED:

Thanks, I can reference auth through config like you said. I was spelling the field incorrectly.