Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 08:32 pm EST

Geeklog Forums

Total Users


GeekAddict

Anonymous
Is there a simple variable I can use to display the total amount of users registered? I basically wanna have Registered Users: xxxxx in my theme header or somewhere.

Thanks!
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
No, but if you look at COM_siteHeader in lib-common.php, you can find where variables are set for the header theme file. Then, you can run a query (SELECT COUNT(*) FROM gl_users, for example), placing the result into a new variable for the theme.

Good luck!
 Quote

GeekAddict

Anonymous
Thanks. Smile

I am not a programmer but I messed around with blocks and tinkered with some MySQL basics, managed to get it done.

I created a block in lib-common.php, looks a bit like this -

$result = mysql_query("SELECT uid FROM gl_users");
$A = mysql_num_rows($result);
$retval .= $A;


Now I have a block with Registered Members: x which is exactly what i wanted!
Not sure on how efficient the code is but it works. Wink
 Quote

Status: offline

vinny

Site Admin
Admin
Registered: 06/24/02
Posts: 352
Location:Colorado, USA
An easier method would be to use DB_count:

Text Formatted Code

$num_users = DB_count($_TABLES['users']);

 


You can make a php block (programmin in lib-custom.php) around that line, returning what you want the block to say.

-Vinny
 Quote

Status: offline

trenchteam

Forum User
Regular Poster
Registered: 06/08/04
Posts: 89
Can anyone explain to me how I can add this function into my stats block? Specifically where it says:

(Total Users:XXXX)
408 Pages Viewed
20 Unique Visits


If that is too complicated, can you possibly explain to me how I can add it to my online block? Thanks again.
 Quote

All times are EST. The time is now 08:32 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