Thanks Earnie but I get the following error:
The default value php code returned an incorrect value
Expected format :
array(Returned value :
0 => array('uid' => value for uid),
// You'll usually want to stop here. Provide more values
// if you want your 'default value' to be multi-valued :
1 => array('uid' => value for uid),
2 => ...
);
Quoting Chris McCreery <chris.mccreery@gmail.com>:
> I'm sure this is an easy one for you php coders but I'm a bit confused as to
> what is currently populating my dropdown list as it is now.
>
> I have created a CCK for user reference, but I would like the default
> value(or selected value) of the dropdown list to be the current user but
> then list out the other users available, I'm not sure of the code to use for
> the PHP Code portion of the default value.
> global $user;
> return array(0 => array('value' => $user->name));
>
<?php
global $user
$result = db_query('SELECT name FROM {users} WHERE name != \'%s\'',
$user->name);
$ret[] = $user->name
while ($u = db_fetch_object($result)) {
$ret[] = $u->name
}
return $ret;
?>
You might also want to ``ORDER BY name'' when doing the select.
Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/
--
[ Drupal support list | http://lists.drupal.org/ ]