![]() |
Community-Auth variables? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Community-Auth variables? (/showthread.php?tid=64565) |
Community-Auth variables? - solidcodes - 03-04-2016 I'm trying to access the variables inside the controller? Code: class Front extends MY_Controller But unfortunately I got this error Code: Message: Undefined property: Front::$auth_username So why is this happening? skunkbad can you help me? thanks in advance. RE: Community-Auth variables? - skunkbad - 03-04-2016 You haven't called any auth method, like is_logged_in, require_role, etc. The variables aren't going to be there until you do. Since you're in the constructor, you might just call $this->is_logged_in() before you need auth_username RE: Community-Auth variables? - solidcodes - 03-04-2016 thanks dude. +1 to make it 20. ![]() RE: Community-Auth variables? - solidcodes - 03-04-2016 actually I want the $auth_username in the view. I tried like this below, Code: <?php but I got error. the proper way to acces the variables in view? thanks in advance. RE: Community-Auth variables? - skunkbad - 03-05-2016 Is_logged_in is a controller method, so call it in the controller with $this-> RE: Community-Auth variables? - solidcodes - 03-05-2016 Hi skunkbad sorry for this inconvenience. I re-dig the codes again and I found out the documentation and the actual codes do not matched. In the documentation for example it says this for view variables. Code: $auth_username But the actual codes said this, Code: // Set user specific variables to be available in all views confusing lol RE: Community-Auth variables? - solidcodes - 03-05-2016 problem solved. RE: Community-Auth variables? - skunkbad - 03-05-2016 (03-05-2016, 08:06 PM)solidcodes Wrote: Hi skunkbad sorry for this inconvenience. You may have an older version of Auth_Controller.php, because auth_user_name was switched to auth_username a while back. This change was made to avoid confusion, but apparently it created some ![]() RE: Community-Auth variables? - solidcodes - 03-05-2016 Yes I'm using old version of CodeIgniter 3.0 only and older version of Community-Auth. This is fine for me now, because I'm in a hurry!!! lol |