2

In my user profile, I have some fields I want to alter. For my regular fields I use:

mymodule_form_alter(&$form, &$form_state, $form_id)

That works, but inside the $form there are some fields missing. Like for example the Timezone settings and the Private Messages. So fields from another module (like Private Messages) or standard settings. How can I alter those?

I tried a custom template file for the user profile and there I have access to those fields inside the $form. But I shouldn't altern them in a template file, right? So what would be the right approach for this?

  • I suggest you put all such code into one "common" module, which contains all custom code that doesn't warrant its own module, like random form hooks etc. – longboardnode Nov 2 '15 at 18:14
0

hook alter normally works on contrib modules. I can see the reason why it has not been working is due to fact that the module needs to be altered got more priority than the altering module.

To overcome such scenario you need to manually change the priority of your custom module, this can be done by changing the value of weight column in system table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.