hi!
a big step in development for me was the "bio node required" setting!
and still i would like to have certain fields be entered on the registration form directly (sure you know from other user's posts).
maybe there is an *easy* way with integrating and using nodeprofile:
i believe that there must be a way to have 2 bio nodes, one is visible/required at the registration form (using nodeprofile setup),
the other one is integrated in the profile page (as is).
so my wish is to have 2 different bio nodes to accomplish this, but both should store the data in the same container.
this could give me the possibility to have:
- a small subset of required AND optional fields on the registration form
- the full list of fields available in the 'my account' setting

if you have an idea how to do this, but you dont want to implement this in future releases, lz give me a hint!
thank you for this fantastic and *very* helpful module!

sam

Comments

webchick’s picture

Assigned: Unassigned » webchick

I'm going to give this a shot. We'll see if I can pull it off or not. ;)

My plan:
- In hook_form_alter, add an option "Show this field on the registration form" like we have on profile module for any CCK fields attached to the "Bio" node type.
- If any of those fields have that option (or are set required, which will mean that they always show up here), then auto-create the profile node on user registration. Unpublished by default.
- Once a user logs in for the first time, mark their profile node published.

jscheel’s picture

Hey, just subscribing. Let me know if I can help!

webchick’s picture

Assigned: webchick » Unassigned
Status: Active » Needs work
StatusFileSize
new2.08 KB

This isn't probably even worth marking code needs work yet, but here's the code that puts the "show on registration form" option on bio CCK fields.

webchick’s picture

Assigned: Unassigned » webchick

Oops. Didn't mean to unassign myself.

michelle’s picture

Thanks for doing this. Your plan sounds great.

Michelle

webchick’s picture

StatusFileSize
new2.67 KB

Actually, I spoke with Jeff (the module author), and he brought up the idea of simply adding a new table to the settings page for "field options" which for now will only contain "Add to registration form", but could in the future contain whatever. So here is the code that goes that way instead. This'll make it faster to simply check off things after the fields have been created, rather than having to edit the fields, and the code is a bit cleaner too, which I like.

webchick’s picture

StatusFileSize
new4.41 KB

This patch has the fields showing up on the form, although they don't do anything yet.

webchick’s picture

Status: Needs work » Needs review
StatusFileSize
new5.55 KB

Ok, here's a patch that seems to be working, at least for simple text fields. Still needs more testing, but I'm marking for review.

webchick’s picture

Ok there were a bunch of problems with that last patch, but I really seriously think this one is ready. ;)

Now, there's a togglable option in the settings form to enable this feature or not, and if it's enabled you can choose which CCK fields to show on the registration form. Required fields are, well, required, so they'll automatically be checked off and can't be unchecked. The bio node will then be created in the background when a user registers.

Attached are the patch and screenshots showing it in action.

I've tested this under the following conditions:
- Text, Number, Node Reference, User Reference, and Date fields.
- A variety of widgets (Text, Options, Autocomplete, Select..)
- Required fields
- Fields with allowed values requiring validation
- Multiple value fields
- Etc.

The only one I can't get working is Imagefield, but the maintainer said, "That's no surprise" so I'd love it if we could fix this in a separate issue.

webchick’s picture

Title: bio and nodeprofile for required fields at registration form » Allow CCK fields on the registration form.

More descriptive title.

robloach’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

Wicked! Tested it out, and worked like a charm! Definitely looking forward to using this in the future. Nicely done, Angie. Much better then the drupal_goto hack. It breaks for me with ImageField 2.x, but I'm sure it's something wrong with my permission setup...

webchick’s picture

Status: Reviewed & tested by the community » Fixed

jjeff gave me commit access, and so this is now fixed. Thanks for the review, RobLoach!

robloach’s picture

No problem, AngieByron!

Christefano-oldaccount’s picture

Ooh, this looks wonderful. Many thanks for getting this done.

prakasht’s picture

Hello Angie

Just want ask a quick question, How to get all the field groups & non-field group (including fields) whatever specified in the bio content type to render in the setting page of bio and if the display in registration form selected then how to render exactly specify in bio content type. Waitng for your reply..

As I think this method need to change... $fields = _bio_get_fields();

Regards

webchick’s picture

Hm. I don't know if I understood that question.

Are you saying you want to put arbitrary CCK fields on the registration form that may or may not be associated with the Bio node type? I would recommend doing that in a custom module in the same way that bio.module is doing it here. You could file a separate feature request/patch for that, but I don't personally have an interest in working on that functionality, sorry. IMO it's out of scope for Bio module.

SamStealth’s picture

great improvement!
tested with text fields, works fine!
but:
i would remove the "always show required fields on registration form" option.
so i am able to decide, which fields are *very* required.
and:
i am missing the "enforce bio node" option. i thought it was ready and working already!

keep up the good work!

robloach’s picture

The "Enforce Bio Node" option isn't needed when we have this functionality, because if one field in the Bio node is required, then the creation of the Bio node is taken care of for us!

webchick’s picture

i would remove the "always show required fields on registration form" option.

Sorry, I can't do that. If all required fields aren't filled in, it'll cause the bio node to fail to create in the background.

webchick’s picture

I just committed the following patch which fixes the problem of the CCK fields being nested inside of themselves.

So now instead of it being:

$form['field_bio']['field_bio'][0]['value']

it's:

$form['field_bio'][0]['value']

Index: bio/bio.module
===================================================================
--- bio/bio.module	(revision 465)
+++ bio/bio.module	(working copy)
@@ -99,9 +99,11 @@
         $module = $widget_types[$field['widget']['type']]['module'];
         $function = $module .'_widget';
 
-        // Get the form field.
-        $form[$field_name] = $function('prepare form values', $node, $field, $node_field);
-        $form[$field_name] = $function('form', $node, $field, $node_field);
+        // Get the form field and add it to the form.
+        $cck_field = $function('prepare form values', $node, $field, $node_field);
+        $cck_field = $function('form', $node, $field, $node_field);
+        $form = array_merge($form, $cck_field);
+
       }
     }
 
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

mrgoltra’s picture

subscribing