private function rejectRelationship($r) { if ($this->registry->getObject('authenticate')->isLoggedIn() == true) { $rel = new Relation($this->registry, $r, 0, 0, 0, 0); if ($rel->getUserB() == $this->registry->getObject('authenticate')->getUser()->getUserID()) { $rel->approveRelationship(); $rel->delete(); $this->registry->errorPage('Relationship deleted', 'We have rejected the relationship.'); } else { $this->registry->errorPage('Invalid request', 'You are not authorized to reject that request'); } } else { $this->registry->errorPage('Please login', 'Please login to reject this connection'); } }