I'm writing an extension to selectively enable access to the Special:CreateAccount page when a user submits a valid invite code on a wiki where self-registration is normally closed.
After a couple of false starts, I settled on what seems like a simple (possibly even functional and elegant?) solution of intercepting the userCan hook for the "read" action and setting $result to TRUE (and returning FALSE to prevent anything else from overriding it) when there's a valid invite.
I've confirmed that the hook is indeed being called (twice) and accurately detecting the invite code, but... the page still displays:
You do not have permission to do that, for the following reason:
You are not allowed to execute the action you have requested.
Am I going about this the wrong way? Is there some other hook I need to intercept, or something I need to set somewhere?
Thanks.