I have a custom content type "userprofile" with several custom fields. How would I go about connecting fields between the custom "userprofile" fields and the user's account profile fields (the default profile fields in drupal). For example, when the user updates the "userprofile" node that data populates the corresponding fields in the user account profile and vice versa.

Can a custom text field's value be connected to a $user field?

Many thanks for any help.

Comments

Anonymous’s picture

Have you looked at the nodeprofile module? http://drupal.org/project/nodeprofile

Doug Gough
ImageX Media

uw07’s picture

Hi Doug, thanks for the reply. Yes, I'm using Node Profile. I created a custom content type titled "User Profile" and integrated it into the default user profile view using Node Profile. I'd like to be able to create fields in the default user profile and connect them to the custom content type "User Profile" fields.

The reason I want to do this is because I can't figure out how to call up values from these custom fields to display blocks. Each user has their own "User Profile" node with information about them. I want to display a block based on what they selected from a select list in that node (they are required to fill out these values during registration). But I can't seem to call up the value when working in a block. The only time print_r displays the custom fields is when I'm actually working in the "User Profile" node. I need to be able to call up those variables on blocks, other pages, etc. The default user profile fields are easily called up using global $user. So I want to tie the "User Profile" fields to the default user profile fields. This way, I can use Node Profile to display this custom content type in the profile, while still being able to call up the data in different parts of the site. But if one is changed, the corresponding field also has to change.

evolvedideas’s picture

I am also in need of this. I want to populate cck fields on a custom node type with peoples account information that they enter in the profile text fields. I am craete a registration site that is useing uc_nodecheckout so fo each membership fee there is a node created by a user whenever they pay for the membership to the organization with their personal information and drupal account info.

thanks,

www.evolvedideas.net

Providing solid evolved online solutions to any variety of ideas.

internets’s picture

The closest thing I've seen are this:

http://drupal.org/node/75727 (references the prepopulate module) which appears to only be for static content placed in the URL.

and

this

http://drupal.org/node/300600

a custom module which I have not been able to implement yet. I tried but have not had success.

Any other ways to get user profile data populated in CCK fields....?

Anonymous’s picture

Sorry to all. I lost track of this thread so I haven't responded. I hope you've found a solution. Do you know about hook_user? http://api.drupal.org/api/function/hook_user.

You can use hook user to detect when a user object is being loaded, and add extra data to the user object. Then when you declare global $user, all of your custom data will be there. This is all assuming that the block displays for the currently logged in user. If you're trying to get the block to display stuff from one user account to other users, then you'll also need to do a user_load http://api.drupal.org/api/function/user_load

Hope that helps somewhat,

Doug Gough

ImageX Media