No more Banned users Part 3
#1 28-11-2010 
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

Step 1. Make a copy of your index.php. Save it in a folder called originals
Step 2. Open the index.php from the forum root and go to line 225. Select line 225 - 239 inclusive and replace with the code below.
Step 3 Change the usergroups in the array to fit your needs.

PHP Code:
// 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
    LIMIT 1
    "
);
    while(
$bfx $db->fetch_array($bfxquery))
           {
                
$stats['newest_user'] = build_profile_link($bfx['username'], $bfx['uid']);
    }
    
// Check who's the newest member.
    
if(!$stats['lastusername'])
    {
        
$newestmember "no new members";
    }
    else
    {
            
        
$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 Smile

Enjoy
The site don't jive? PRESS F5 Flower

0
#2 22-03-2011 
  • Registered
  • 0
  • 3
Thanks again for all your work with this! Just signed up on this site today, but we had been talking before over on the MyBB site. Anyway, I've been using this mod for a few months, and just noticed a nuance... Let's say 2 users sign up... User1 today and User2 tomorrow. User1 does not reply to my activation questions, so he does not get activated initially. However, User2 responds right away, and gets activated. User2 then shows up as the newest user. A few days later, User1 responds to my questions and I activate the account. User1 never shows up as the newest user -- newest user remains User2, because User2 REGISTERED most recently.

Your thoughts? Is there a way to make this look at activation time, instead of registration time?

0
#3 22-03-2011 
Hmmm, thats an interesting one. At the moment it's taking its last user data from the MYBB default stats table. This means we minimise the amount of queries, but the default table is sorting on last userid rather than date.

I will have a look at it.
The site don't jive? PRESS F5 Flower

0
#4 30-11-2011 
  • Registered
  • 0
  • 3
Hello again... Just upgraded to MyBB 1.6.5, and the index.php has been changed to add birthday functions. The line number range is now 265-279 inclusive. I made the changes, and everything seems to once again be working as it should be. Have you, by chance, had any time to review 1.6.5? See any need for further updating?

0
#5 30-11-2011 
hi Jayfore - thank you for the update. I have not gone with 1.6.5 yet, I am waiting for some mods to be updated Smile
The site don't jive? PRESS F5 Flower

0
#6 07-07-2012 
  • Registered
  • 0
  • 3
On 1.6.8, the section to select has changed from lines 280-294, inclusive... At least in my case. I went from 1.6.6 > 1.6.7 > 1.6.8, and this was all that I needed to change, after doing 2 consecutive (changed files) upgrades.

0
#7 07-07-2012 
Thank you for the update jayfore - I have yet to move to 1.6.8 so that is good to know.
The site don't jive? PRESS F5 Flower

0


Sorry, that is a members only option