For some reason, I can't use hook_form_alter on the user_register form. Is there something different that needs to be done when using content profile? Just to test, I did this:

function cmr_form_alter (&$form, $form_state, $form_id) {
  drupal_set_message($form_id);
}

Every single form on the website is outputting a form id (even the edit profile form) but not the user register form. Help!

Comments

Anonymous’s picture

+1

jamiehollern’s picture

I've made some progress on this. By emptying caches I've managed to print the form array for user_register but this is a very small form and not what I'm looking for. Then, I tried to print the node form that the content profile is based on and voila, it printed. However it hasn't printed everything so I can't see the whole array.

jamiehollern’s picture

Priority: Normal » Major
Issue tags: +hook_form_alter

Apologies, but it seems that my progress was not what I thought it was. I'm back at square one. I've tried to use hook_form_alter to add a new validation function but it won't work on user sign up. A nudge in the right direction would be much appreciated.

jamiehollern’s picture

Bump. This is really starting to get frustrating. I have a perfectly good function that needs to run in order for my site to work properly and this stupid module is ensuring that it is impossible to do. Could one of the developers please just point me and everyone else who has this problem in the right direction? Why does hook_form_alter not affect a content profile registration form? How do you override this behaviour? I'm doing everything right but this module behaves in a way that obstructs other modules.

Anonymous’s picture

Please help us. Same problem here ;(

grendzy’s picture

content_profile_registration is installed with a system weight of 1 - so if you need your alter hooks to run after content_profile you'll need to adjust the weight of your custom module to something higher than 1. See http://drupal.org/node/110238

jamiehollern’s picture

Component: Base module » User registration module

Thanks very much for this, it's a good start. In my case, I am trying to alter values before they are submitted to the database but after the content profile registration form has been rendered. I'm unsure how to approach this, as I need my submit function to run before the data hits the database, but I'm not sure when $form_state['content_profile_registration'] is created.

I have tried to alter my $form_state in a [#submit] function that I array_unshift to be the first that runs but for some reason, $form_state['content_profile_registration'] still doesn't contain my altered values, even though $form_state['values'] contains the altered values.

Can anyone tell me the best way to (cleanly) alter these values before node_save is called?

baaj’s picture

Hey, I'm trying to do much the same thing. Were you able to figure this out?

Thanks!