[development] Restricting node reference by uid

Earl Dunovant prometheus6 at gmail.com
Mon Sep 6 16:28:11 UTC 2010


menu_get_object() ought to do it.

On Mon, Sep 6, 2010 at 12:02 PM, Earl Miles <merlin at logrus.com> wrote:

> On 9/6/2010 5:56 AM, Jerad Bitner wrote:
> > One problem with the views filter I've had is that when you limit it
> > by uid, and you try to edit someone else's content as admin, the
> > nodereference is no longer available, because you are not the original
> > user. Has anyone found a reliable way to filter by current user OR
> > admin? I was unsuccessful last time I tried using views_or to try to
> > do this.
>
> Assuming the nodereference filter can receive the nid of the node being
> edited as an argument (that's the part I'm unclear on, but you can't do
> this if you can't somehow get the node) then you need some PHP argument
> code that attempts to load the node. If lot loads, return $node->uid; if
> not, return $GLOBALS['user']->uid.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100906/e811ebe5/attachment.html 


More information about the development mailing list