How can I check if the author of the current node is the current logged in user? I am trying to execute a Rule based on the condition of whether the currently logged in user, is currently viewing their node (a node they are the author of), or viewing someone else's node. The Rule event/trigger I am using is "User saves a Status" from Statuses module. Next I have used the Rules condition "Execute Custom PHP code", and set an if statement that checks whether the current node uid (the uid of the node's author) equals the current user uid:

if ($node-&gt;uid == $user-&gt;uid) {
  return TRUE;
}
else {
  return FALSE;
}


This is causing a bunch of "Trying to get property of non-object" errors, as both the $node and $user variables are not being recognised. I'm not sure why this is the case, do I need to use the node_load() and user_load() functions before using these variables? If so how?
I have managed to work it out! Below is the code for checking whether the current user is viewing content they are an author of:

global $user;
if (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) {
  // Get the nid
  $nid = arg(1);

  // Load the node if you need to
  $node = node_load($nid);
}

if($node-&gt;uid == $user-&gt;uid){
return TRUE;
} else {
return FALSE;
}


Hope this is helpful to someone.