Download & Extend

Autofill with user's profile email

Project:Email Field
Version:6.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I m using a content profile node type with CCK and email Field, and would like to make available in the content profile the email of the drupal user related to this content profile type. Each drupal users have a content profile , but they do not edit their content profile. There is another admin user that complete content profile for each users.
The problem is that is i would like to autofill the email cck field with the drupal user's email that is already entered.
When i use the php code in the default value :
global $user;
return array(
0 => array('your_field_name' => $user->mail),
);

it works but it autofills the email with the admin user email who is logged but not with the user profile i m editing. How can i code this in php, to retrieve the uid of the user i m editing his content profile and get his email field ? I have some useful information in the url http://mysite.com/user/30/profile/profile?uid=30&destination=user%2F30

Thanks in advance for your support

Comments

#1

Why not use computed field instead ? you could then put the php snippet to get the user email for his/her account.

#2

I must admit i need this as well, i want to automatically insert the user email as the default value, but computed field wont work for me as i need to allow the user to change the email address if to something else if they want.

Considering we can use PHP or tokens for the default value (no idea why!) is there any other suggestions?

nobody click here