PDA

View Full Version : Stop Banned Users from being Newest Member


bananalive
02 Jun 2009, 13:05
Prevents Banned Users from Displaying in What's Going On? Statistics phrase: Welcome to our newest member
Open file: includes/functions_databuild.php
Find:
$newuser = $vbulletin->db->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid = $members[maxid]");
Replace:
$newuser = $vbulletin->db->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid != '8' ORDER BY userid DESC");
Save File

NewAyenee
23 Jun 2009, 00:52
I've applied this change to my page, but I'm not seeing it take affect on the page.

The current newest user is in the banned group, and when I try what the query should be from the AdminCP Execute SQL Query page, I get the right results, but when I refresh the index page, I keep seeing the banned user as the newest.

Is there anything else I need to do to get this to work correctly?


EDIT
Just as a test, I changed later lines on the page to return fixed values in the values array, like so:
$values = array(
'numbermembers' => $members['users'],
'activemembers' => $members['active'],
'newusername' => "testuser",
'newuserid' => "0"
);
And it still got the banned user as the newest user, as it's always been getting. Even putting an exit() statement in the page didn't prevent it from running.

It's the only file on the host with that function and that query, but it doesn't seem to be working, and I'm not sure why.

SurfCityvBer
23 Jun 2009, 19:08
I believe I've had this problem before when deleting a banned user -- try going into the Maintenance menu and Update Counters, Update User Titles and Ranks.

NewAyenee
24 Jun 2009, 00:19
I believe I've had this problem before when deleting a banned user -- try going into the Maintenance menu and Update Counters, Update User Titles and Ranks.
Well, there was already a cron job set through vBulletin to handle that, so this morning (by the time I saw your response), it had already taken effect.

Qwk86gn
29 Jun 2009, 07:51
Thanks :)

bananalive
29 Jun 2009, 09:23
To update the newest member immediately you can go:

AdminCP -> Scheduled Tasks -> Scheduled Tasks Manager -> Daily Statistics Log -> run now

Sweeks
01 Jul 2009, 19:25
After running the task it isnt working for me here somehow.
________
KTM LC4 (http://www.cyclechaos.com/wiki/KTM_LC4)

BigDog56
21 Jul 2009, 13:42
Worked like a charm! thank you for this tip!

sebaot
28 Jul 2009, 16:09
Thanks for an awesome tip! It wasn't cool to see banned users and their names come up on the forum index. I used this, but I modified the query some:


$newuser = $vbulletin->db->query_first("SELECT userid, username FROM `" . TABLE_PREFIX . "user` WHERE joindate=(select max(joindate) from user where usergroupid!=8)");


I guess it should theoretically create a bit slower query on the database server, but result in less memory being allocated since the result is slimmed down to 1 row instead of all members in the users-table, even if the business class uses query_first. Never ran any tests to verify it, though. :-)

goshalim
10 Aug 2009, 19:40
I've applied this change to my forum but I'm not seeing it take affect on the forum , and still showing the banned users.

goshalim
11 Aug 2009, 20:52
On the other hand it complitely stoped to welcomes new members. this is not what i wanted . Just to prevent the welcome for the Banned users