![]() |
[4.5.1] Disabling the debug toolbar on certain pages - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: [4.5.1] Disabling the debug toolbar on certain pages (/showthread.php?tid=90667) |
[4.5.1] Disabling the debug toolbar on certain pages - keto - 04-15-2024 Hello, I upgraded from version 4.4.4 to version 4.5.1, and I encountered a new error. Previously, to prevent the debug toolbar from appearing on a script or the login page, I had implemented the following in the file `\app\Config\Boot\development.php` : PHP Code: $page = current_url(true)->getSegment(1); However, this no longer works because `current_url` is not accessible on this page anymore. So, I tried to do the same thing a bit further in \app\Config\Events.php: PHP Code: $page = current_url(true)->getSegment(1); Although the `echo` statements indicate the correct path on the tested pages, the toolbar still opens on the login page. It must be a simple coding error, but I can't figure it out. Thank you for your assistance. RE: [4.5.1] Disabling the debug toolbar on certain pages - ozornick - 04-15-2024 Try 'filter system'. Create new filter, test URL from request and disable Toolbar filter. Or set except. See https://codeigniter.com/user_guide/incoming/filters.html#except-for-a-few-uris RE: [4.5.1] Disabling the debug toolbar on certain pages - keto - 04-15-2024 But of course! I've previously implemented similar exceptions for my session management filter. So, I attempted this in "\app\Config\Filter.php" PHP Code: /** However, unfortunately, the toolbar continues to load on the login page. RE: [4.5.1] Disabling the debug toolbar on certain pages - kenjis - 04-16-2024 Cannot reproduce on CI 4.5.1. Code: --- a/app/Config/Filters.php RE: [4.5.1] Disabling the debug toolbar on certain pages - keto - 04-16-2024 Thank you for your help, I've found the solution! While reviewing your modification, I noticed that the 'extends' of the 'class' wasn't the same in my configuration file. So, I reverted to an original file from version 4.5.1 and forgot to update it, even though it's clearly mentioned at the end of the guide: https://codeigniter4.github.io/userguide/installation/upgrade_450.html After updating the Filter.php and applying your modification, it works as intended. Thanks! |