Browse Source

Fix delete

Visman 2 years ago
parent
commit
54ea710623
2 changed files with 5 additions and 3 deletions
  1. 2 2
      app/Models/Post/Delete.php
  2. 3 1
      app/Models/Topic/Delete.php

+ 2 - 2
app/Models/Post/Delete.php

@@ -153,7 +153,7 @@ class Delete extends Action
             $query = 'SELECT p.poster_id
             $query = 'SELECT p.poster_id
                 FROM ::posts AS p
                 FROM ::posts AS p
                 INNER JOIN ::topics AS t ON t.id=p.topic_id
                 INNER JOIN ::topics AS t ON t.id=p.topic_id
-                WHERE t.forum_id IN (?ai:forums)
+                WHERE t.forum_id IN (?ai:forums) AND p.poster_id>0
                 GROUP BY p.poster_id';
                 GROUP BY p.poster_id';
 
 
             $uidsUpdate = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
             $uidsUpdate = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
@@ -175,7 +175,7 @@ class Delete extends Action
             ];
             ];
             $query = 'SELECT p.poster_id
             $query = 'SELECT p.poster_id
                 FROM ::posts AS p
                 FROM ::posts AS p
-                WHERE p.topic_id IN (?ai:topics)
+                WHERE p.topic_id IN (?ai:topics) AND p.poster_id>0
                 GROUP BY p.poster_id';
                 GROUP BY p.poster_id';
 
 
             $uidsUpdate = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);
             $uidsUpdate = $this->c->DB->query($query, $vars)->fetchAll(PDO::FETCH_COLUMN);

+ 3 - 1
app/Models/Topic/Delete.php

@@ -92,7 +92,9 @@ class Delete extends Action
 
 
         if ($topics) {
         if ($topics) {
             foreach ($topics as $topic) {
             foreach ($topics as $topic) {
-                $uidsUpdate[$topic->poster_id] = $topic->poster_id;
+                if ($topic->poster_id > 0) {
+                    $uidsUpdate[$topic->poster_id] = $topic->poster_id;
+                }
             }
             }
         }
         }