How to use form API to edit sub form that is added to user_register_form I need to alter a Redhen Contact form when it is attached to the user registration form.  More generically, I need to alter a sub form.  The form is added to user_register_form() via hook_form_FORM_ID_alter() in rendhen_contact.module:1029.  (I don't think this is specific to Redhen's implementation; I'm just providing this as a reference point.)

The first issue I encountered was that the hook implementation in redhen_contact.module hadn't occurred when my hook was called.  In a custom module, I used hook_module_implements_alter() to resolve that (see screenshot at bottom for kpr()).  With that I'm still unable to alter, for example, the #title attribute of field_agency_interest.  Even if I do $form['redhen_contact]['form']['field_agency_interest']['und']['#title'] or ...['und'][0]['title'] it doesn't change.

I tried using $form['#after_build'][] = 'module_callback_name' but I can't edit the sub form elements.



How can I alter a sub form added to a form?
You probably forgot to reference the $form variable ("&amp;$form").
The alternative to #after_build would be #pre_render, which misses $form_state but should generally be preferred for changes that only affect the rendering of a form.