Welcome to Geeklog, Anonymous Saturday, September 07 2024 @ 09:54 pm EDT
Geeklog Forums
Total Members Block
Status: offline
ronack
Forum User
Full Member
Registered: 05/27/03
Posts: 612
I wanted a simple count of the amount of users so I created this block function which displays "Total Members: #".
Place the following in your lib-custom.php
function phpblock_usercount(){
GLOBAL $_TABLES, $_USER;
$result = mysql_query( "SELECT * FROM {$_TABLES["users"]} WHERE uid <> '0' ");
$usercount = mysql_num_rows($result);
$return = "Total Members: ";
$return .= $usercount;
return $return;
}
Then create the php block phpblock_usercount you can call it what you want I called it Members.
Place the following in your lib-custom.php
Text Formatted Code
function phpblock_usercount(){
GLOBAL $_TABLES, $_USER;
$result = mysql_query( "SELECT * FROM {$_TABLES["users"]} WHERE uid <> '0' ");
$usercount = mysql_num_rows($result);
$return = "Total Members: ";
$return .= $usercount;
return $return;
}
Then create the php block phpblock_usercount you can call it what you want I called it Members.
5
6
Quote
Status: offline
TechSys
Forum User
Regular Poster
Registered: 12/02/03
Posts: 90
Nice little addition there. Just added it to my site (very little users though) and it worked like a charm.
http://70.145.174.180/
http://70.145.174.180/
7
3
Quote
Status: offline
r_f_o_t
Forum User
Full Member
Registered: 07/30/03
Posts: 241
Location:Illinois
Nice little block. I did make one small change so it would not count anon users.
changed
to
Thanks,
Chuck
Too many hands on my time.
changed
Text Formatted Code
WHERE uid <> '0' ");to
Text Formatted Code
WHERE uid > '1' ");Thanks,
Chuck
Too many hands on my time.
5
6
Quote
All times are EDT. The time is now 09:54 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content