[support] Default PHP Code for CCK field

Chris McCreery chris.mccreery at gmail.com
Thu Nov 1 20:10:17 UTC 2007


Thanks but still no luck just that same error. Since I'm just trying to
specify the default for this field and it is already getting the possible
users to reference am I just trying to specify the default value? If so then
do I need to run a query or just tell Drupal which uid I'd like to use?
Would the following work? ( it doesn't but that just might be my syntax.

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

On 11/1/07, Earnie Boyd <earnie at users.sourceforge.net> wrote:
>
> Quoting Chris McCreery <chris.mccreery at gmail.com>:
>
> > Thanks Earnie but I get the following error:
> >
> > The default value php code returned an incorrect value
> > Expected format :
> >
> > array(
> >  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 => ...
> > );
> >
> > Returned value :
> >
> > So I assume it needs an array and would the $global user already exist?
> >
>
> $ret[] = array('uid'=>$u->uid,'name'=>$u->name);
>
> Yes the global $user exists.  I'm not familiar with CCK user reference
> but was giving you code based on your earlier example and your stated
> requirement.
>
> HTH,
> Earnie -- http://for-my-kids.com/
> -- http://give-me-an-offer.com/
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 
Chris McCreery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20071101/60ad6e3b/attachment.htm 


More information about the support mailing list