If you can advise that would help. As it is the code causing the issue.
Sorry but without the error you don’t know that for sure, it could have been a typo from when the code was added previously, or the location, there are lots of other possibilities. The code I gave you is a simple filter, it should either work or fail silently, not give error 500.
Can you check the error logs and see what the actual error was? The reason I’m asking is I’m using the exact code I gave you previously without any problems on a couple of test sites.
That’s just 2 incognito windows, the left I commented the code out and ran a registration with my account details (logged out), the right I had the code running and repeated the test, that time I could continue the registration.