Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 09:57 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
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.
 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/
 Quote

Status: offline

ronack

Forum User
Full Member
Registered: 05/27/03
Posts: 612
I have one site with about 85 and another with about 45. The hope here is that people will see the site as popular and register.
 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
Text Formatted Code
 WHERE uid <> '0' ");
 

to
Text Formatted Code
WHERE uid > '1' ");
 


Thanks,

Chuck
Too many hands on my time.
 Quote

All times are EDT. The time is now 09:57 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