Hi,
I would like to use Inline Registration with the Content Profile and Content Profile User Registration profile. The later adds fields from specified content types to the user registration form and creates the corresponding profile nodes on user registration. Obviously field addition is done through hook_form_alter.
It seems that hook_form_alter implementations are not invoked when adding the user registration form into the node creation one.
I tried to add a simple call to drupal_prepare_form in inline_registration_form_alter like this
function inline_registration_form_alter(&$form, $form_state, $form_id) {
global $user;
if ($user->uid == 0 && variable_get('inline_registration_'. $form['#node']->type, 0)) {
//...
$form['register']['form'] = drupal_retrieve_form('user_register', $form_state);
drupal_prepare_form('user_register', $form['register']['form'], $form_state);
// Remove the user_register submit button in favor of the node submit button
unset($form['register']['form']['submit']);
// Rename the user field to remind the user that this is the registration form and not a login field
$form['register']['form']['name']['#title'] = t('Choose a Username');
//...
}
//...
}
Of course it doesn't work. The form is now completed with the fields from content_profile_registration_form_alter hook. But form submission does not behave correctly and instead returns to the page with all field empty and no error message.
I would try to dig this issue later. In the meantime, any help or advice would be appreciated.
Comments
Comment #1
betz commentedYeah, i'm looking for exactly the same.
Did you had any luck with this?
Comment #2
mlncn commentedChanging the weight of the module (such that inline_registration comes after content_profile) is probably the most common, simple approach to this sort of problem.
Comment #3
betz commentedTried this, but this doesn't work neither.
Changed the weight to -20 once, cleared caches, nothing changes.
Also tried to change weigt to 20 and cleared my caches.
@benjamin, are you sure this will work then, is it working with you somewhere?
Comment #4
mlncn commented@betz - um, are you using mongolito404's code?
Comment #5
betz commentedAahh, LOL
No, will try it now...
thanks ;)
Comment #6
betz commentedwoohooo, it works!
thanks a lot
Comment #7
betz commentedCan this be commited?
Comment #8
Anonymous (not verified) commentedHello,
I have the same problem and do all of this thread but nothing works.
This is my inline-registration.modul:
I changed the weigth to 20 and to -20
The weight of Content Profile User Registration is 1
Please, help me.
Kind regards
Tom
Comment #9
alongir commentedHi.
Using drupal_prepare_form breaks the rest of the node/add/ form. The inline registration works perfect. The content profile fields are added. However the rest of the form breaks (only CCK list fields actually).
Any ideas?
Comment #10
lucascaro commentedHi all, just wanted to add that this looked like working, but it breaks cck text fields (option widgets).
Comment #11
lucascaro commentedSorry, I'm just marking it as needs work to reflect the cck isues alongir and I are having.
Comment #12
elamanIssue is very old. Closing it.