[development] Restricting node reference by uid

Earl Miles merlin at logrus.com
Mon Sep 6 16:02:01 UTC 2010

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.

More information about the development mailing list