mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-22 09:31:28 +02:00
[ticket/17029] Update post count when changing post visibility
PHPBB3-17029
This commit is contained in:
@@ -501,11 +501,15 @@ class content_visibility
|
|||||||
$postcounts[$num_posts][] = $poster_id;
|
$postcounts[$num_posts][] = $poster_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$postcount_change = 0;
|
||||||
|
|
||||||
// Update users postcounts
|
// Update users postcounts
|
||||||
foreach ($postcounts as $num_posts => $poster_ids)
|
foreach ($postcounts as $num_posts => $poster_ids)
|
||||||
{
|
{
|
||||||
if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED)))
|
if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED)))
|
||||||
{
|
{
|
||||||
|
$postcount_change -= $num_posts;
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $this->users_table . '
|
$sql = 'UPDATE ' . $this->users_table . '
|
||||||
SET user_posts = 0
|
SET user_posts = 0
|
||||||
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '
|
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '
|
||||||
@@ -520,6 +524,8 @@ class content_visibility
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$postcount_change += $num_posts;
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $this->users_table . '
|
$sql = 'UPDATE ' . $this->users_table . '
|
||||||
SET user_posts = user_posts + ' . $num_posts . '
|
SET user_posts = user_posts + ' . $num_posts . '
|
||||||
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids);
|
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids);
|
||||||
@@ -527,6 +533,11 @@ class content_visibility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($postcount_change != 0)
|
||||||
|
{
|
||||||
|
$this->config->increment('num_posts', $postcount_change, false);
|
||||||
|
}
|
||||||
|
|
||||||
$update_topic_postcount = true;
|
$update_topic_postcount = true;
|
||||||
|
|
||||||
// Sync the first/last topic information if needed
|
// Sync the first/last topic information if needed
|
||||||
|
Reference in New Issue
Block a user