Sandy Posted April 20, 2023 Posted April 20, 2023 Hi - Any idea why this isn't working?... I want to render a message on the login screen, so added a hook to the /site/ready.php file: <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); $this->addHookBefore('ProcessLogin::execute', function(HookEvent $event) { echo "Test Message"; }); Any idea why it's not rendering anything? I copied the code straight from here: https://processwire.com/api/ref/process-login/execute/ Thanks
Sandy Posted April 20, 2023 Author Posted April 20, 2023 FYI, it's writing the message just fine when the code's placed outside the hook, so ready.php is working as expected.
Jan Romero Posted April 21, 2023 Posted April 21, 2023 Unfortunately I have nothing to contribute, but I tested your exact code on a PW 3.0.183 installation of mine and it worked as expected, so maybe the problem lies somewhere else? 1
Sandy Posted April 28, 2023 Author Posted April 28, 2023 On 4/21/2023 at 11:26 AM, Jan Romero said: Unfortunately I have nothing to contribute, but I tested your exact code on a PW 3.0.183 installation of mine and it worked as expected, so maybe the problem lies somewhere else? Thanks Jan. Yes, I've also got roughly the same code running successfully on another site, so it must be a setting somewhere. Any ideas where to look for something that could interfere with a hook like that?
kuba Posted June 6, 2024 Posted June 6, 2024 @Sandy Did you manage to discover what was the issue that hooks don't work inside /site/ready.php?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now