How can I check a Rules condition to see if the Statuses sender and recipient are the same? I am using "Execute custom PHP" as a condition in a Rule which is being triggered when a new Status is saved. Here is the PHP I am using, it keeps causing "Trying to get property of non-object" errors whenever I create a new status:

if($sender-&gt;uid == $recipient-id){
return TRUE;
} else {
return FALSE;
}


Basically what I am trying to do is detect cases when the sender is sending a status message to himself so I can use an appropriate Rules action, and also the opposite:

if($sender-&gt;uid != $recipient-id){
return TRUE;
} else {
return FALSE;
}


I have tried a number of different variable combinations but I can't work out what I am doing wrong. Any suggestions?
This should do what you want.

if($status-&gt;sender == $status-&gt;recipient) {
  drupal_set_message('A match');
}
else{
  drupal_set_message('Not a match');
}


Rules Code

{ "rules_status_test" : {
    "LABEL" : "Status Test",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "php", "rules", "fbss_rules" ],
    "ON" : { "statuses_save" : [] },
    "IF" : [
      { "php_eval" : { "code" : "if($status-\u003Esender == $status-\u003Erecipient) {\r\n  drupal_set_message(\u0027A match\u0027);\r\n}\r\nelse{\r\n  drupal_set_message(\u0027Not a match\u0027);\r\n}" } }
    ],
    "DO" : []
  }
}