Pull values from Drupal User Profile to CCK fields

Surprisingly hard to find, certain snippets floating around on the web do not work for specific versions of CCK. So far these are foolproof with Drupal 6.

global $user;
return array(0=> array('value' => $user->uid));

global $user;
return array(0=> array('value' => $user->name));

global $user;
$account = user_load(array('uid' => $user->uid));
return array(
0 => array('value' => $account->profile_commloc),
);

global $user;
return array(0 => array('value' => $user->mail));

Add new comment