I need to get results from
"PHP code" in "Default value" section in Node reference.
when I run in dev "Execute PHP Code" script like that:
global $user;
$venue = content_profile_load('jobseeker_profile', $user->uid);
dpm ($venue->field_profile_first_name[0]['value']);
or
global $user;
$venue = content_profile_load('jobseeker_profile', $user->uid);
return ($venue->field_profile_first_name[0]['value']);
it gives me a result in message area with no problem.
But if I put in "PHP code" in "Default value" section
global $user;
$venue = content_profile_load('jobseeker_profile', $user->uid);
return array(
0 => array('value' => $venue->field_profile_first_name[0]['value']),
);
or
global $user;
$venue = content_profile_load('jobseeker_profile', $user->uid);
return array(
0 => array('nid' => $venue->field_profile_first_name[0]['nid']),
);
then I get empty result, no strings.
I tried also that with no success:
$refnid = node_load(array('type'=>'jobseeker_profile', 'uid'=>$node->uid));
return array(
0 => array('nid' => $refnid->nid )
);
Comments
Comment #1
clashar commentedcould anyone help?
Comment #2
gluebox commentedThis is more as a breadcrumb for myself, or others that find this node. Here's the code I used to prefill a CCK field form the current user's profile.
(Remove the PHP open/close tags)
Comment #3
clashar commented.gluebox, thank you!
I don't use anymore D6 and can't check your solution, but I hope it could help someone else)