The college user selects in his profile is the default value of college when he creates any types of nodes.

1. I tried the following PHP code in the default value :
return array(
0=> array('value'=> $content_profile->get_variable('profile', 'college') ),
)

When i save it, i get the following error:
Fatal error: Call to a member function get_variable() on a non-object in /home1/mufocusc/public_html/sites/all/modules/cck/includes/content.admin.inc(1247) : eval()'d code on line 2

2. When i save with :
return array(
0=> array('value'=> $content_profile->get_variable('profile', 'college'); ),
);

i get the following error:
The default value PHP code returned an incorrect value.
Expected format:
return array(
0 => array('value' => value for value),
// You'll usually want to stop here. Provide more values
// if you want your 'default value' to be multi-valued:
1 => array('value' => value for value),
2 => ...
);
Returned value:

Comments

adityagada’s picture

Solves the problem :

global $user;
$college = content_profile_load('profile', $user->uid);
return array(
   0 => array('value' => $college->field_college[0]['value']),
);

But content_profile_load('profile', $user->uid); loads the entire profile.
how do i just load one field "field_college"?