Jump to content

Recommended Posts

Posted

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

 

Posted

FYI, it's writing the message just fine when the code's placed outside the hook, so ready.php is working as expected.

Posted

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?

  • Like 1
Posted
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?

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...