By Anonymous (not verified) on
Hi,
I have a user form that when logged in I would like to automatically pull the users profile fields as default values for name, company, phone number etc.. I am using the bio module which I have renamed to "account". I tried to create a custom module as well insert the code directly in the default value of the cck field. However, the most I can get is "1". Any suggestions?
$qname = db_query("SELECT (field_account_fname_value) FROM (content_type_account) INNER JOIN node ON (content_type_account.nid = node.nid) WHERE (node.uid = $user->uid)");
Comments
The query is unnecessary.
The query is unnecessary. All of the current user's profile fields are quickly available by loading the user object:
Just replace "profile_firstname" with "profile_" and the name of your profile field.
Bio Field as CCK Field Default Value
Okay.. for anyone who wants to populate a CCK field from another CCK field that a user has previously completed (such as bio field) you can create a custom module and add the following for each field you would like to include a default value for. The reason why I needed this function was to allow customers, when logged in, to have their profile fields automatically populated when submitting a quote inquiry. I didn't want to use webform because I needed to be able to setup custom views to sort by location, product etc. for the sales team.
More details on how you did this please
Could you please share the steps you took in creating / setting up the module and having it called from your form.
I'm trying to take cck user profile data (created with the content_profile module http://drupal.org/project/content_profile)
I tried simply making a module with the your code and enabling it but I'm not getting any fields to populate.
I made a .module file
profile_data_to_cck.module
I created the .info file and enable the module but see no field getting populated.
I've also tried changing the
to, using the field's name
and tried the input id 'edit-title'
nothing has worked yet.
Any suggestions appreciated.
Thanks