CodeIgniter Forums
Community Auth - Call to undefined method - 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 - Call to undefined method (/showthread.php?tid=67996)



Community Auth - Call to undefined method - Elvina - 05-06-2017

Hello!
Please help me!
When I add the code to the controller:
Code:
if( $this->require_role('admin') )
{
   
}
Indicates an error:
Code:
Fatal error: Call to undefined method Welcome::require_role() in /home/q/q9273345/q9273345.beget.tech/public_html/app_crm/controllers/Welcome.php on line 35
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/q/q9273345/q9273345.beget.tech/public_html/app_crm/controllers/Welcome.php:35)

Filename: core/Common.php

Line Number: 573

Backtrace:

A PHP Error was encountered

Severity: Error

Message: Call to undefined method Welcome::require_role()

Filename: controllers/Welcome.php

Line Number: 35

Backtrace:

But under the link http://q9273345.beget.tech/examples/index everything works. Errors do not show.


RE: Community Auth - Call to undefined method - skunkbad - 05-06-2017

Your Welcome.php controller needs to extend MY_Controller.


RE: Community Auth - Call to undefined method - Elvina - 05-07-2017

(05-06-2017, 02:18 PM)skunkbad Wrote: Ваш контроллер Welcome.php должен расширить MY_Controller.

Thank you very much!