Пример #1
0
 public function beforeDelete()
 {
     // ToDo: Handle this via event of User Module
     if ($this->object_model == User::className()) {
         $notification = new \humhub\modules\user\notifications\Followed();
         $notification->originator = $this->user;
         $notification->delete($this->getTarget());
         foreach (Activity::findAll(['object_model' => $this->className(), 'object_id' => $this->id]) as $activity) {
             $activity->delete();
         }
     }
     return parent::beforeDelete();
 }
Пример #2
0
 public function beforeDelete()
 {
     // ToDo: Handle this via event of User Module
     if ($this->object_model == User::className()) {
         /*
          $user = User::model()->findByPk($this->user_id);
          $activity = Activity::model()->contentContainer($user)->findByAttributes(array('type' => "ActivityUserFollowsUser", 'object_id' => $this->object_id));
          if ($activity !== null) {
          $activity->delete();
          }
         *
         */
         $notification = new \humhub\modules\user\notifications\Followed();
         $notification->originator = $this->user;
         $notification->delete($this->getTarget());
     }
     return parent::beforeDelete();
 }