View Full Version : Help with very small hack?
SaintDog
03-11-2002, 05:24 AM
I am pretty sure this would be a small if/then/else statement, but since I totally suck at php, I am hoping another member at this forum will be willing to help me out here.
What I would like to have is something that will display the member count for Admins & Mods only and will just take the whole line "Currently Registered: ..." out for members.
If anyone could help, I would appreciate it very much, I don't think it would be too much to do, but then again as I said, I really and totally suck at PHP.
Thanks in advance,
SaintDog
Ok. In index.php Find.
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
and replace with
if (in_array($bbuserinfo['usergroupid'], array(5, 6, 7))) {
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
}
:rambo:
SaintDog
03-11-2002, 01:20 PM
Thanks for the response, sorry to say though, that does not work. I am running 2.2.4, when I am logged in, it works fine, I can see it, but when I log out to check it, it states there is a problem with the database (does not show any errors).
Any help is appreciated,
Thanks.
SaintDog
ok, try
if (in_array($bbuserinfo['usergroupid'], array(5, 6, 7))) {
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
} else {
$numbermembers="";
}
ohh and I am using 2.2.4 aswell ;)
SaintDog
03-11-2002, 02:38 PM
That does not work either.
SaintDog
Scott MacVicar
03-11-2002, 03:15 PM
open index.php
look for
$numbermembers=number_format($numbersmembers['users']);
below it add
unset($membertotal);
if(ismoderator("","",$bbuserinfo[userid])) {
$membertotal = "Members: $numbermembers,";
}
open up your forum home template and replace
Members: $numbermembers,
with $membertotal
SaintDog
03-11-2002, 03:31 PM
Thanks PPN, worked like a charm. :)
Thank you for your help Neo, I appreciate you trying to help me out :)
SaintDog
Scott MacVicar
03-11-2002, 04:09 PM
No problem, it really only lets moderators view it, but i'm presuming that your admins have super mod access :)
Admin
03-11-2002, 04:14 PM
You realize people will be able to see the number of people from the memberlist, right? :)
Scott MacVicar
03-11-2002, 04:24 PM
lol good point :) but it will require a tiny bit more effort to get to it hehe
Good catch firefly.... (man I need to get better at vb code)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.