Thanks for the replay. I have created a CCK field for User Reference. Right now it displays all possible users to select. I am trying to set the default selected user to the current user. I go to the content type I created and then select the field to configure. I have the option for a default value, it lets me select a specific user or I can enter php code to make this dynamic. So I would like to set the default selected item to be the current user. All the suggestions I've tried in previous replies all result in the following error when I submit the change to the custom field
<br><br><br>
The default value php code returned an incorrect value<br>Expected format : <pre>array(<br> 0 => array('uid' => value for uid),<br> // You'll usually want to stop here. Provide more values<br> // if you want your 'default value' to be multi-valued :
<br> 1 => array('uid' => value for uid),<br> 2 => ...<br>);</pre>Returned value :<br><br>Any help would be awesome because as you can see I have limited coding skills.<br><br>Thank you so much.<br><br><div>
<span class="gmail_quote">On 11/1/07, <b class="gmail_sendername">Cog Rusty</b> <<a href="mailto:cog.rusty@gmail.com">cog.rusty@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 11/2/07, Chris McCreery <<a href="mailto:chris.mccreery@gmail.com">chris.mccreery@gmail.com</a>> wrote:<br>> Ok I'm so lost here, does anyone know what I should be putting in here.<br>><br>> So far I have
<br>><br>> global $user;<br>> array ( 0 => array ('uid' => $user=>uid));<br>><br>> Do I need return array? No idea what the format should be.<br><br><br>Global $user is an object, not an array, so the user id is $user->uid
<br><br>Besides that, I can't say whether you need to return or to print<br>something. I am not sure what you are trying to do, what errors<br>exactly you are getting, or what doesn't work as it should.<br><br><br>
> On 11/1/07, Xavier Bestel <<a href="mailto:xavier.bestel@free.fr">xavier.bestel@free.fr</a>> wrote:<br>> ><br>> > Le jeudi 01 novembre 2007 à 16:28 -0400, Chris McCreery a écrit :<br>> > > Grrrrrrrrrrrrrrrrrrrrrrrrrrr, ok nothing seems to work everything I
<br>> > > put in there gives me the same error.<br>> > ><br>> > > This is what I have now.<br>> > ><br>> > > global $user;<br>> > > return array(0 => array('uid' => $user=>uid));
<br>> ><br>> > Maybe try<br>> > array('uid' => $user['uid'])<br>> ><br>> ><br>> > --<br>> > [ Drupal support list | <a href="http://lists.drupal.org/">http://lists.drupal.org/
</a> ]<br>> ><br>><br>><br>><br>> --<br>> Chris McCreery<br>> --<br>> [ Drupal support list | <a href="http://lists.drupal.org/">http://lists.drupal.org/</a> ]<br>><br>--<br>[ Drupal support list |
<a href="http://lists.drupal.org/">http://lists.drupal.org/</a> ]<br></blockquote></div><br><br clear="all"><br>-- <br>Chris McCreery