mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
- fixing some bugs
- shortening some db columns to meet the requirements - correctly increase/decrease user post counts - fix the topic title length bug(s) git-svn-id: file:///svn/phpbb/trunk@6224 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -209,37 +209,17 @@ class acp_main
|
||||
trigger_error($user->lang['NO_ADMIN']);
|
||||
}
|
||||
|
||||
$post_count_ary = $auth->acl_getf('f_postcount');
|
||||
$forum_read_ary = $auth->acl_getf('f_read');
|
||||
|
||||
$forum_ary = array();
|
||||
foreach ($post_count_ary as $forum_id => $allowed)
|
||||
{
|
||||
if ($allowed['f_postcount'] && $forum_read_ary[$forum_id]['f_read'])
|
||||
{
|
||||
$forum_ary[] = $forum_id;
|
||||
}
|
||||
}
|
||||
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE post_postcount = 1
|
||||
GROUP BY poster_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!sizeof($forum_ary))
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id <> ' . ANONYMOUS . '
|
||||
AND forum_id IN (' . implode(', ', $forum_ary) . ')
|
||||
GROUP BY poster_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}");
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
$db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}");
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
||||
|
||||
|
Reference in New Issue
Block a user