Support for Content Profile User Registration

mongolito404 - July 9, 2009 - 14:22
Project:Inline Registration
Version:6.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Issue tags:user experience, user registration
Description

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

<?php
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.

#1

betz - September 11, 2009 - 15:00

Yeah, i'm looking for exactly the same.
Did you had any luck with this?

#2

agaric - September 11, 2009 - 23:38

Changing 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.

#3

betz - September 12, 2009 - 07:57

Tried 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?

#4

agaric - September 13, 2009 - 22:38

@betz - um, are you using mongolito404's code?

#5

betz - September 14, 2009 - 05:54

Aahh, LOL

No, will try it now...

thanks ;)

#6

betz - September 14, 2009 - 06:04

woohooo, it works!

thanks a lot

#7

betz - September 14, 2009 - 06:05
Status:active» reviewed & tested by the community

Can this be commited?

 
 

Drupal is a registered trademark of Dries Buytaert.