Sandy Posted April 20, 2023 Share 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 Link to comment Share on other sites More sharing options...
Sandy Posted April 20, 2023 Author Share 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. Link to comment Share on other sites More sharing options...
Jan Romero Posted April 21, 2023 Share 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 Link to comment Share on other sites More sharing options...
Sandy Posted April 28, 2023 Author Share 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? Link to comment Share on other sites More sharing options...
kuba Posted June 6 Share Posted June 6 @Sandy Did you manage to discover what was the issue that hooks don't work inside /site/ready.php? Link to comment Share on other sites More sharing options...
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