/**
  * Send a notification to a subscriber
  *
  * @param Elgg_Notifications_Event $event  The notification event
  * @param int                      $guid   The guid of the subscriber
  * @param string                   $method The notification method
  * @return bool
  * @access private
  */
 protected function sendNotification(Elgg_Notifications_Event $event, $guid, $method)
 {
     $recipient = get_user($guid);
     if (!$recipient || $recipient->isBanned()) {
         return false;
     }
     // don't notify the creator of the content
     if ($recipient->getGUID() == $event->getActorGUID()) {
         return false;
     }
     if (!has_access_to_entity($event->getObject(), $recipient)) {
         return false;
     }
     $actor = $event->getActor();
     $object = $event->getObject();
     if (!$actor || !$object) {
         return false;
     }
     $language = $recipient->language;
     $params = array('event' => $event, 'method' => $method, 'recipient' => $recipient, 'language' => $language, 'object' => $object);
     $subject = elgg_echo('notification:subject', array($actor->name), $language);
     $body = elgg_echo('notification:body', array($object->getURL()), $language);
     $notification = new Elgg_Notifications_Notification($event->getActor(), $recipient, $language, $subject, $body, '', $params);
     $type = 'notification:' . $event->getDescription();
     if ($this->hooks->hasHandler('prepare', $type)) {
         $notification = $this->hooks->trigger('prepare', $type, $params, $notification);
     } else {
         // pre Elgg 1.9 notification message generation
         $notification = $this->getDeprecatedNotificationBody($notification, $event, $method);
     }
     if ($this->hooks->hasHandler('send', "notification:{$method}")) {
         // return true to indicate the notification has been sent
         $params = array('notification' => $notification, 'event' => $event);
         return $this->hooks->trigger('send', "notification:{$method}", $params, false);
     } else {
         // pre Elgg 1.9 notification handler
         $userGuid = $notification->getRecipientGUID();
         $senderGuid = $notification->getSenderGUID();
         $subject = $notification->subject;
         $body = $notification->body;
         $params = $notification->params;
         return (bool) _elgg_notify_user($userGuid, $senderGuid, $subject, $body, $params, array($method));
     }
 }