When using hook_form_alter on the user.module’s form

I recently spent some time scratching my head and trying to troubleshoot some very odd behavior when using hook_form-alter() on the user_form. The checkbox for the “agree” to the legal ease stopped working for one thing. In addition to that, the form refused to redirect even though I was doing everything right. I quadruple checked my syntax and methods over and over. What could it be?!

As it turns out, it was a permissions problem. Dugh! I had set the access to be true if the user was logged in as a certain role. However, as we all know the user form only work for anonymous user so that they can log in. If the user is logged in, it does not allow access. By trying to use hook_form_alter() with a permissions conflict the resulting form was understandably misbehaving.

So there you have it. Another honest admission of a lesson learned by trial and error. I hope this will save someone a few hours in their efforts.

One thought on “When using hook_form_alter on the user.module’s form

  1. You are actually right- since I made this video the folks at WordPress have made the ilatanlstion process much more user-friendly, and you can now basically just run through their web-based installer without ever editing the files or creating databases. Technology ages quickly! The method demonstrated here still works fine, and the power users out there will probably still enjoy doing it this way.

Leave a Reply

Your email address will not be published. Required fields are marked *