Enabling multiple content profile types for user registration only gives the node->title and node->body fields for the last (in order) content profile type.
To Reproduce:
1) Install content profile and it's user registration component
2) Enable two content types to be used for content profile
3) Enable these content profiles to be available for registration
4) On the registration form, you will only get one body and title field.
The attached patch fixes this problem, by suffixing the body and title fields with the node type. Later on submit, it fills the body and title fields with the correct node type values and let's node save handle the rest.
Comment | File | Size | Author |
---|---|---|---|
#1 | content-profile-registration-939146-1.patch | 1.75 KB | nohup |
Comments
Comment #1
nohup CreditAttribution: nohup commentedPatch file attached.
Comment #2
nohup CreditAttribution: nohup commentedComment #3
BlackCatWeb CreditAttribution: BlackCatWeb commentedI have the same problem - needing both content profiles showing at registration. However, even with your patch, only one still shows. Any clues?
Comment #4
notasheep CreditAttribution: notasheep commentedFollowing
Comment #5
stefan81 CreditAttribution: stefan81 commentedsubscribe
Comment #6
eelkeboezeman CreditAttribution: eelkeboezeman commentedsubscribe
Comment #7
eelkeboezeman CreditAttribution: eelkeboezeman commentedpatch works great
Comment #8
nohup CreditAttribution: nohup commented@BlackCatWeb: Did you apply it to the content_profile_registration.module ?
Comment #9
Skybax CreditAttribution: Skybax commentedHello Nohup
Your patch did not work in my case.
I had first multiple node types activated for profile registration. But then unchecked it all, uninstalled and
deleted the profile content module.
Then reinstalled it, but still the same. Can you tell me in which table I can find this check box for registration then I can maybe alter it in the database.
I used your patch for content_profile_registration.module , but nothing changed. (I did it manually).
Still only the body field and the title field that appears for registration.
But one inside you can create such a content type (or edit it) and you can see the other fields.
So only in registration it does not show up.
I did the patch manually:
So the first part becomes:
// Add in the new form elements into $form.
$form += array('#field_info' => array());
$form['#field_info'] += $node_form['#field_info'];
//change the body and title
$body_field='body_field_'.$type;
$form_add['body_field']['body_'.$type]=$form_add['body_field']['body'];
unset($form_add['body_field']['body']);
$form_add[$body_field]=$form_add['body_field'];
$form_add['title_'.$type]=$form_add['title'];
unset($form_add['body_field'],$form_add['title']);
//fix the format field to be after the body field
if(isset($form_add[$body_field]['format'])) {
$form_add[$body_field]['_format']=$form_add[$body_field]['format'];
unset($form_add[$body_field]['format']);
$form_add[$body_field]['format']=$form_add[$body_field]['_format'];
unset($form_add[$body_field]['_format']);
}
$form += $form_add;
Second part:
function content_profile_registration_user_register_validate($form, &$form_state) {
require_once drupal_get_path('module', 'node') .'/node.pages.inc';
foreach ($form['#content_profile_registration_use_types'] as $type => $typename) {
// Set the body and title for the current type
if(isset($form_state['values']['body_'.$type])){
$form_state['values']['body']=$form_state['values']['body_'.$type];
}
if(isset($form_state['values']['title_'.$type])){
$form_state['values']['title']=$form_state['values']['title_'.$type];
}
$node = (object)$form_state['values'];
$node->type = $type;
node_object_prepare($node);
If there is any fault in my manually patching can you let me know?
Thanks.
Comment #10
nohup CreditAttribution: nohup commentedTry the following
/user/register
, you will see the title and body from only one of the content typescontent_profile/modules
directorypatch -p0 content_profile_registration.module < /path/to/content-profile-registration-939146-1.patch
/user/register
pageComment #11
operations CreditAttribution: operations commentedHi nohup,
I have two roles (parent, teacher).. I defined 2 content types as user profiles for that; using the Content Profile module.
I used Auto Assign Role module v6.x-2.0-beta1 , cause v6.x-1.2 (the official release) displays a warning on the content profile settings page of a content type (foreach warning). Then, I used the built-in content type and changed the name to Parent, then added another one for teacher. So, I had 2 content types as profiles each one of them has its own cck fields to be displayed in the appropriate user role page. I applied the Assign from path option which is in the AAR module settings page.
For ex:- register/parent => some fields ....
register/teacher => another fields .... to be determined using permissions of each role.
My problem I have now, is that no edit link is displayed for the registered user once he/she login!! Though I configured everything correctly, and I didn't have this error before unless I added the auto assign role from path and multiple profiles. .
Update: That was because of not assigning the roles access to content and content profiles. I was in a hurry :)
Comment #12
operations CreditAttribution: operations commentedAlso, I have two tabs in the admin user (uid:1) , when editing a user from the users list page..
First tab: Teacher Profile, second tab: Parent Profile ! I guess it shouldn't be like this as its annoying once the user has been built for a specific role (1 role value must be there).
Please let me know if I'm heading wrong ?
Comment #13
fralenuvol CreditAttribution: fralenuvol commentedThe above patch fixes for me also another issue:
I have 2 content types enabled on user registration page, one with body field, the other one with body field hidden.
When user registers, the hidden body field, instead of being empty, gets saved with the same value of the visible body field of the other content type.
The patch of comment #1 solves the issue.
Thanks nohup.
Comment #14
mogop CreditAttribution: mogop commentedsubscribe
Comment #15
YK85 CreditAttribution: YK85 commentedsubscribing
Comment #16
sketman CreditAttribution: sketman commentedHi, doesnt solve this the Auto Assign Role module?
http://drupal.org/project/autoassignrole
I works with Content Profile module...
Comment #17
pmathur01 CreditAttribution: pmathur01 commentedHi,
I have multiple registrations on my website. In the first case I have a user(Role1) that uses Profile1 and the second case user (Role2) uses Profile 2. Is there some way that I can make the user choose the Role and then based on the role the Profile is shown to the user. Example in My Account Profile 1 is shown to Role1 users and Profile 2 is shown to Role 2 users.
I used Auto asign role module but I am not able to show how the registration forms are to be shown.. Can someone help with how to how proceed.
Thanks,
Prerna
Comment #18
operations CreditAttribution: operations commentedHi Prerna,
Have you checked the auto assign role settings at this page:
/admin/user/autoassignrole
third fieldset: Allow User to Choose
You can choose which roles can be determined and more options there.
Is this what you need ?
Comment #19
pmathur01 CreditAttribution: pmathur01 commentedHi,
Thanks, I did use that and it is assigning the role but it is not populating the content profiles based on that role. How do I choose as to what profile to display on the Account page based on that role. Right now it is displaying both the profiles on My Account page.
Thanks,
Prerna
Comment #20
operations CreditAttribution: operations commentedThats strange, I did the same and it worked for me. However, please be sure that you enable "assign from path" fieldset in the same admin page settings for auto assign role.
Here is what I did in details:
I think in your case you don't need the "allow user to choose" to be enabled. "Allow user to choose" lets the users choose from a set of roles during the registration page.
Please let me know if you are still stuck in it so I can help you further, as I spent a lot of time before figuring it out.
Enjoy :)
Comment #21
pmathur01 CreditAttribution: pmathur01 commentedThanks for your help. I did not get one thing when u say that I need to "create a starting page that has two links or photos in order to let the users choose the appropriate role before entering their information." I am providing the login/register on my front page. Do I create another block with "Role2 Register Here" with a url directing them to some page. If so which page?
Comment #22
operations CreditAttribution: operations commentedSorry for late reply I was a bit busy on some projects. I meant that you can create a page (node of type page) with two links to the two paths you've already defined in the AAR configurations (Assign from path). This will enable you to determine the role of the user before displaying the required fields.
Please let me know if you still don't get my point.
--Mohannad