0
votes

Anyone got any ideas?

I'm a tad stuck, trying to make an action run arbitrary php to execute upon publication of the most recent revision. What I'm trying to do is get a list of users to notify about the change, specifically the users who have permission to edit said node.

Now I've got the $object returning my node id so I'm fine there, and I can get a list of users easy enough to cycle through them and check permissions. The hard bit is the permission check itself. Nothing I've tried seems to be able to provide permissions for 'publish' or 'update' on node x for user y.

I'm using the nodeaccess module to give individual users access to specific nodes btw, just for fun.

1

1 Answers

0
votes

If anyone else struggles with this, this is what I did.

//whichever nid goes in here, I put in a number to make this easy to read and understand.
$node_obj=node_load(598);
//$result_object contains the 'users' table with uid
while ($result_object=db_fetch_object($result))
{

   $this_user=$result_object->uid;
   $this_user_object=user_load($this_user);
   $access=node_access('update', $node_obj, $this_user_object);
   if ($access==1)
   {
     //mail the user or do whatever
   }
}