My current project is using content profile module and not core profile module for profiles, so I wrote some code supporting profile import with content profile. The existing content profile registration module already does the heavy lifting of injecting fields into the registration form and creating the nodes, so I built upon that. To make the patch work, you need to do the following:
- configure the appropriate content type and fields you want to show on the registration form (http://example.com/admin/content/node-type/TYPE/profile)
- configure rpx to use the 'content profile' module instead of profile module (new field) and map the profile fields (http://example.com/admin/settings/rpx/profile)
If using a select or radios for one of the profile fields, note that the option keys must match what's returned by janrain for the code to work. Gender is most likely case for this, so if you go this route, make sure your allowed options are something like this:
male|Male
female|Female
It would be a nice feature to map select/radio options as well but my current project didn't call for it, so it's work for another time.
The code in the patch supports the field types I needed on my site (text, content taxonomy, date, link), but it should be relatively easy to expand support for additional field types since the code's mainly just prepopulating the fields on the registration form with data provided by janrain.
Also, the patch includes everything in the patch I previously contributed for #875946: rpx_registration form does not honor changes to user registration form made with hook_form_alter() b/c content profile registration uses hook_form_alter() and not hook_user() to inject the extra fields.
Comments
Comment #1
gwen commentedI found out that the previous patch actually doesn't run the validation functions in rpx_registration_validate() if any other module adds to $form['#validate']. I think it's happening b/c the code to make hook_form_alter() functions for the user registration forms populates $form['#validate'] with functions, so drupal does not add the default FORM_validate() function to the #validate array. I rewrote to do the form alters on the user registration forms by altering the rpx_registration form instead of doing it in the initial form definition.
Additionally, this patch tweaks the field options on the rpx profile fields page (http://example.com/admin/settings/rpx/profile) by removing the fields that content profile module hides on the reg form.
Comment #2
Rob_Feature commentedHas there been any further testing on this yet? Is it working? Trying to decide right now if I can go with content profile and rpx or if I'm safer just using profile module (which isn't ideal).
Comment #3
nrambeck commentedI haven't tested this patch yet myself, but it sounds like it is working for gwen.
If you'd be willing to test out the patch, I could commit it to the dev branch afterwards.
Comment #4
Rob_Feature commentedI did test this a little bit and it seemed to work ok. It didn't import data into all kinds of cck fields, however (I tried to use it to import into Location CCK but the field doesn't show as an option). It also wasn't going to be able to import the user's avatar/photo into a filefield, so I basically abandoned going this route. I didn't see a huge advantage over just using Profile for my needs.
So for now, my very minimal testing found it works mostly as advertised. Based on how little I used it, though, I'd still leave it as 'needs review'.
Comment #5
pedrospAny chance to see this patch commited to Dev ? (no available on last october 13th release)
Re-patching
Comment #6
gddThe last patch didn't apply anymore so here is a re-roll. I also removed the unnecessary info file cruft. Hope to whip this into shape to get it committed as we need it on a project we're working on.
Comment #7
gddAnd... actually attaching the patch this time
Comment #8
nrambeck commentedGreat. I'm willing to commit this to dev if 1 or 2 more people will review the latest patch from heyrocker.
Comment #9
kevinquillen commentedHaven't tried this yet, but what about if the fields are not present during registration and you use a ctools multistep form instead?
Is it possible to have a hook_user call during login, check for RPX, and loop that data and insert it into the content profile if the fieldname matches? For example, with Facebook, field_gender to gender, field_fullname to preferredName? Then save the content type?
I think that could work. I'm looking into this for someone currently who wants it right now... will let you know how it turns out.
Edit: Or even having a profile mapper hook into content type profile would be good too.
Comment #10
samhassell commentedI'm using heyrocker's patch in #7 under d6 and can't seem to get the data to save to the content_profile fields. The patch applied correctly.
I think the rpx_registration form should update the cck fields whenit is submitted but for some reason its not.. hrm...
The content profile node isn't even being created.
Content Profile Registration module is working fine if I register normally.
Comment #11
samhassell commentedThe patch in #7 relies on 'Force registration form' being selected in Site Configuration->RPX->Settings. If that is not set, the content_profile fields will not be added to the rpx registration form and content profile doesn't know a user is registering.
Not sure if this should hold the patch back as it works as advertised once 'Force registration form' is enabled. Setting to reviewed as I'd like to see it included as is :)
Comment #12
john.karahalis commentedThe patch seems to work here. With the right configuration (more on that in a second...), the Content Profile fields do appear and are populated with RPX data.
The only problem is that I have reservations about the usability of this new feature. There are many steps that must be taken for this to work properly, but the interface doesn't make it obvious what those steps are. It looks like samhassell had similar problems -- he reported his confusion at 3am and wasn't able to resolve it until 10pm.
Comment #13
kevinquillen commentedYes, what is the proper way to get this working?
Comment #14
kevinquillen commentedNM - I got it.
One final thing I would ask though, is there a way to add functionality to map the profile picture field from the User picture to a ImageField CCK in the Content Profile node type?
Comment #15
Michsk commentedHave you maybe looked at making this work with 6.x-2.x ?
Comment #16
pdumais42 commentedI opened a new ticket. http://drupal.org/node/1197012
Comment #17
reinis.berzins commentedA temporary solution is to use this module: http://drupal.org/project/auto_nodetitle to generate a title field value of the Content Profile node, using a token. Otherwise first login would display an error alert and ask to complete the Content Profile information manually.
Comment #18
Abeaudrian commentedHi heyrocker,
I hope all is great! Will this patch be ported into the 6.x-2 branch anytime soon?
Regards,
Adrian
Comment #19
jim kirkpatrick commentedHere's rooting for a 2.x branch version of the patch in #7!