Joomla 3.9.24
There's a similar question here but it deals with changing the language string, whereas I'd like to change the page content and / or redirect.
I have allowed user registration on my site and the New User Account Activation
option is set to Admin
, so the user will be emailed a link to activate their account before they can log in. Then all users set to receive system emails and who have the permission to create users will be notified to activate the user's account.
This works as expected. However if the user clicks the activation link a second time the following message is displayed;
Error 403 - verification code not found
The same applies to the admin approval stage, e.g. Staff Member A clicks the activation link to approve the user, all fine. Then Staff Member B clicks the same activation link later that day, they see;
Error 403 - verification code not found
It seems logical, and good UX, that rather than a 403 error
(which normally means access is forbidden), there should be a custom message displayed to the user e.g.;
Sorry, there was a problem, we couldn't validate that code, it may be:
- Already validated
- Expired
Is there any way to display / redirect to a custom URL if the user has already been activated? Preferably without editing core files.
I'm aware that Joomla does not store the activation token once a user has been activated.
Presumably I'd have to check that the activation token didn't exist, then check that the user did exist and was activated? Then display the custom content? Not sure where or how to start this customisation.
Do I need to override core files? Create a custom plugin?
Could be reading into this too much but I think it should be a core feature of Joomla? Other sites I've registered on have this functionality (e.g. MailChimp).
onAfterRoute
event or by setting a custom error handler.onAfterRoute
event and for custom error handler take a look atSystem - Redirect
plugin.