And here it is - part 3 of the "hide banned users" code edits - index stats
. This one gave me a fair bit of trouble as the required code is IN index.php, and so I wanted to keep the load as light as possible - preferably with no queries - it was not to be though. No matter what I did I could not get this edit to work without putting an extra SQL query in the index.
I think its worth it though - now we can welcome a real user rather than a banned spammer.
This one is really easy - we will get the stats.php query and run it in the index php. I tried just calling the variables, but also no luck.
Index php http://crossreference.mybboard.de/index.php.html
. Make a copy of your index.php. Save it in a folder called originals
. Open the index.php from the forum root and go to line 225. Select line 225 - 239 inclusive and replace with the code below.
Change the usergroups in the array to fit your needs.
// Build the forum statistics to show on the index page.
if($mybb->settings['showindexstats'] != 0)
// First, load the stats cache.
$stats = $cache->read("stats");
$bfxquery = $db->query("
SELECT u.*, f.*, u.usergroup
FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
WHERE u.usergroup NOT IN ('7','1')
ORDER BY u.uid DESC
while($bfx = $db->fetch_array($bfxquery))
$stats['newest_user'] = build_profile_link($bfx['username'], $bfx['uid']);
// Check who's the newest member.
$newestmember = "no new members";
$newestmember = $stats['newest_user'];
For those who are still reading......
This code is a bit odd - it is loading the cache from the stats.php - but that cache is created BEFORE we run our mod in the stats php - so the data in the cache is not correct. So we load the cache (we have to have the cache data for the threads and posts) and then we run our query for the username, then we splice our query into the stats.cache. Um yeah. Sort of.
Anyhoo - it works