/**
  * Build a link to an alert's content so that the system can redirect to
  * it.
  *
  * @param MybbStuff_MyAlerts_Entity_Alert $alert The alert to build the
  *                                               link for.
  *
  * @return string The built alert, preferably an absolute link.
  */
 public function buildShowLink(MybbStuff_MyAlerts_Entity_Alert $alert)
 {
     $pmId = $alert->getObjectId();
     return "{$this->mybb->settings['bburl']}/private.php?action=read&pmid={$pmId}";
 }
Beispiel #2
0
 /**
  * Add a new alert.
  *
  * @param MybbStuff_MyAlerts_Entity_Alert $alert The alert to add.
  *
  * @return $this
  */
 public function addAlert(MybbStuff_MyAlerts_Entity_Alert $alert)
 {
     $fromUser = $alert->getFromUser();
     if (!isset($fromUser['uid'])) {
         $alert->setFromUser($this->mybb->user);
     }
     $alertType = $alert->getType();
     $usersWhoWantAlert = $this->doUsersWantAlert($alert->getType(), array($alert->getUserId()));
     if ($alertType->getEnabled() && (!empty($usersWhoWantAlert) || !$alertType->getCanBeUserDisabled())) {
         if ($alertType->getCode() === 'quoted') {
             // If there is already an alert queued to the user of the type
             // 'post_threadauthor', don't add the alert.
             $extraDetails = $alert->getExtraDetails();
             $tid = $extraDetails['tid'];
             if (isset(static::$alertQueue['post_threadauthor_' . $alert->getUserId() . '_' . $tid])) {
                 return $this;
             }
         }
         $passToHook = array('alertManager' => &$this, 'alert' => &$alert);
         $this->plugins->run_hooks('myalerts_alert_manager_add_alert', $passToHook);
         // Basic duplicate checking by overwrite - only one alert for each alert type/object id combination
         static::$alertQueue[$alert->getType()->getCode() . '_' . $alert->getUserId() . '_' . $alert->getObjectId()] = $alert;
     }
     return $this;
 }
 /**
  * Build a link to an alert's content so that the system can redirect to it.
  *
  * @param MybbStuff_MyAlerts_Entity_Alert $alert The alert to build the link for.
  *
  * @return string The built alert, preferably an absolute link.
  */
 public function buildShowLink(MybbStuff_MyAlerts_Entity_Alert $alert)
 {
     return "wiki.php?action=view&id=" . $alert->getObjectId();
 }