mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 15:16:16 +02:00
[feature/soft-delete] Fix display_user_activity()
The Logic of $forum_ary was inverted, so if the array is empty, we can skip the queries. We also should not merge passworded forums into the $forum_ary as we removed them from that array right before that. PHPBB3-9567
This commit is contained in:
parent
9441774288
commit
2841ecc44f
@ -996,8 +996,11 @@ function display_user_activity(&$userdata)
|
||||
}
|
||||
}
|
||||
|
||||
$forum_ary = array_diff($forum_ary, $user->get_passworded_forums());;
|
||||
$forum_ary = array_diff($forum_ary, $user->get_passworded_forums());
|
||||
|
||||
$active_f_row = $active_t_row = array();
|
||||
if (!empty($forum_ary))
|
||||
{
|
||||
// Obtain active forum
|
||||
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
|
||||
FROM ' . POSTS_TABLE . '
|
||||
@ -1021,10 +1024,6 @@ function display_user_activity(&$userdata)
|
||||
}
|
||||
|
||||
// Obtain active topic
|
||||
// We need to exclude passworded forums here so we do not leak the topic title
|
||||
$forum_ary_topic = array_unique(array_merge($forum_ary, $user->get_passworded_forums()));
|
||||
$forum_sql_topic = (!empty($forum_ary_topic)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary_topic, true) : '';
|
||||
|
||||
$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||
@ -1045,6 +1044,7 @@ function display_user_activity(&$userdata)
|
||||
$active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
}
|
||||
|
||||
$userdata['active_t_row'] = $active_t_row;
|
||||
$userdata['active_f_row'] = $active_f_row;
|
||||
|
Loading…
x
Reference in New Issue
Block a user