Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Recalculation forum replies in Tools #4721

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion e107_plugins/forum/forum_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2263,6 +2263,8 @@ function forumUpdateCounts($forumId, $recalcThreads = false)
$forumId = (int)$forumId;
$threads = $sql->count('forum_thread', '(*)', 'WHERE thread_forum_id='.$forumId);
$replies = $sql->count('forum_post', '(*)', 'WHERE post_forum='.$forumId);
$replies = $replies - $threads;

$sql->update('forum', "forum_threads={$threads}, forum_replies={$replies} WHERE forum_id={$forumId}");
if($recalcThreads == true)
{
Expand All @@ -2272,7 +2274,7 @@ function forumUpdateCounts($forumId, $recalcThreads = false)
foreach($tlist as $t)
{
$tid = $t['post_thread'];
$replies = (int)$t['replies'];
$replies = (int)$t['replies'] - 1;
$sql->update('forum_thread', "thread_total_replies={$replies} WHERE thread_id={$tid}");
}
}
Expand Down