Ejemplo n.º 1
0
 /**
  * unsubscribe topic
  *
  * @param  $oMbqEtForumTopic
  */
 public function unsubscribeTopic($oMbqEtForumTopic)
 {
     //ref wcf\data\user\object\watch\UserObjectWatchAction::unsubscribe()
     $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread');
     $userObjectWatch = UserObjectWatch::getUserObjectWatch($objectType->objectTypeID, WCF::getUser()->userID, intval($oMbqEtForumTopic->topicId->oriValue));
     if ($userObjectWatch->watchID) {
         $editor = new UserObjectWatchEditor($userObjectWatch);
         $editor->delete();
         // reset user storage
         $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID));
     }
     return true;
 }
 /**
  * Removes a subscription.
  */
 public function unsubscribe()
 {
     $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $this->parameters['data']['objectType']);
     if ($this->userObjectWatch !== null) {
         $userObjectWatch = $this->userObjectWatch;
     } else {
         $userObjectWatch = UserObjectWatch::getUserObjectWatch($objectType->objectTypeID, WCF::getUser()->userID, intval($this->parameters['data']['objectID']));
     }
     $editor = new UserObjectWatchEditor($userObjectWatch);
     $editor->delete();
     // reset user storage
     $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID));
 }
Ejemplo n.º 3
0
 /**
  * unsubscribe topic
  *
  * @param  Mixed  $var($oMbqEtForumTopic or $objsMbqEtForumTopic)
  */
 public function unsubscribeTopic(&$var)
 {
     if (is_array($var)) {
         MbqError::alert('', __METHOD__ . ',line:' . __LINE__ . '.' . MBQ_ERR_INFO_NOT_ACHIEVE);
     } else {
         //ref wcf\data\user\object\watch\UserObjectWatchAction::unsubscribe()
         $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', 'com.woltlab.wbb.thread');
         $userObjectWatch = UserObjectWatch::getUserObjectWatch($objectType->objectTypeID, WCF::getUser()->userID, intval($var->topicId->oriValue));
         if ($userObjectWatch->watchID) {
             $editor = new UserObjectWatchEditor($userObjectWatch);
             $editor->delete();
             // reset user storage
             $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID));
         }
     }
 }