aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/memberlist.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/memberlist.php')
-rw-r--r--phpBB/memberlist.php67
1 files changed, 38 insertions, 29 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 546ee37148..afcdafe09f 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1166,44 +1166,53 @@ function show_user_activity(&$member)
$post_count_ary = $auth2->acl_getf('!f_postcount');
$forum_read_ary = $auth->acl_getf('!f_read');
-
+
$forum_ary = array();
- foreach ($post_count_ary as $forum_id => $allowed)
+
+ // Do not include those forums the user watching this profile is not having read access to...
+ foreach ($forum_read_ary as $forum_id => $not_allowed)
{
- if ($allowed['f_postcount'] || $forum_read_ary[$forum_id]['f_read'])
+ if ($not_allowed['f_read'])
{
- $forum_ary[] = $forum_id;
+ $forum_ary[] = (int) $forum_id;
}
}
- $post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : '';
-
- if ($post_count_sql)
+ // Now do not include those forums where the posts do not count for the members profile...
+ foreach ($post_count_ary as $forum_id => $not_counted)
{
- $sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
- WHERE p.poster_id = {$member['user_id']}
- AND f.forum_id = p.forum_id
- $post_count_sql
- GROUP BY f.forum_id, f.forum_name
- ORDER BY num_posts DESC";
- $result = $db->sql_query_limit($sql, 1);
- $active_f_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
- WHERE p.poster_id = {$member['user_id']}
- AND t.topic_id = p.topic_id
- AND f.forum_id = t.forum_id
- $post_count_sql
- GROUP BY t.topic_id, t.topic_title
- ORDER BY num_posts DESC";
- $result = $db->sql_query_limit($sql, 1);
- $active_t_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ if ($not_counted['f_postcount'])
+ {
+ $forum_ary[] = (int) $forum_id;
+ }
}
+ $forum_ary = array_unique($forum_ary);
+ $post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : '';
+
+ $sql = 'SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
+ FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
+ WHERE p.poster_id = {$member['user_id']}
+ AND f.forum_id = p.forum_id
+ $post_count_sql
+ GROUP BY f.forum_id, f.forum_name
+ ORDER BY num_posts DESC";
+ $result = $db->sql_query_limit($sql, 1);
+ $active_f_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
+ WHERE p.poster_id = {$member['user_id']}
+ AND t.topic_id = p.topic_id
+ AND f.forum_id = t.forum_id
+ $post_count_sql
+ GROUP BY t.topic_id, t.topic_title
+ ORDER BY num_posts DESC";
+ $result = $db->sql_query_limit($sql, 1);
+ $active_t_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
$member['active_t_row'] = $active_t_row;
$member['active_f_row'] = $active_f_row;