Currently it's not possible to map to user profiles fields created by the core profile module. The attached patch adds this functionality, but only for fields that are visible on the user registration form. This is to do with the way profile_save_profile() and _profile_get_fields() work. Longer term it'd be nice if it worked for fields that don't appear on the registration form, but the same result could be achieved by changing the profile field settings after the initial import.

Cheers,
Stella

CommentFileSizeAuthor
user_profile_fields.patch832 bytesstella

Comments

mikeryan’s picture

Status: Needs review » Needs work

Wouldn't omitting WHERE register=1 give all profile fields?

Thanks.

stella’s picture

Status: Needs work » Needs review

yes, but if you look at the source code of profile_save_fields() and in particular _profile_get_fields() , you'll see that it'll only process those with register = 1 when inserting new users. So I put in the "WHERE register = 1" so as to not show fields to the user that we can't update.

mikeryan’s picture

Assigned: Unassigned » mikeryan

OK, I've created a separate profile.inc and implemented a solution for all profile fields (stash them away in the prepare_user hook then call profile_save_profile() in the complete_user hook).

This is not heavily tested at the moment (in particular, I didn't test all the types of profile fields), please give it a spin and let me know if you have any trouble.

Thanks!

stella’s picture

Will do, thanks

mikeryan’s picture

I committed it, do a cvs update...

stella’s picture

Status: Needs review » Fixed

Yep, that works great, thanks!

Status: Fixed » Closed (fixed)

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