1
RImark
How to display # of registered users in a block
  • 2006/8/15 3:45

  • RImark

  • Just popping in

  • Posts: 24

  • Since: 2004/10/20


I'd like to have a block where I can display the number of registered users we have. Seems like a simple thing. Nice would be a graphical counter kind of numbers. I would be happy with an HTML/text solution however.

Thanks

RIMark

2
metropolis
Re: How to display # of registered users in a block
  • 2006/8/15 7:47

  • metropolis

  • Not too shy to talk

  • Posts: 159

  • Since: 2004/7/15


Look for a module called xm-memberstats. It provides (among other things) a block with the number of registered users.

3
Dave_L
Re: How to display # of registered users in a block
  • 2006/8/15 11:20

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


If you don't find that module, here's an example:

$member_handler =& xoops_gethandler('member');
$criteria  = new Criteria('level'1'>=');
$usercount $member_handler->getUserCount($criteria);
echo 
"Registered Users: $usercount";

4
RImark
Re: How to display # of registered users in a block
  • 2006/8/15 20:23

  • RImark

  • Just popping in

  • Posts: 24

  • Since: 2004/10/20


Awesome! That's just what I was looking for. Simple & Clean. Thanks. Mark (RIMark)

5
RImark
Re: How to display # of registered users in a block
  • 2006/8/15 20:24

  • RImark

  • Just popping in

  • Posts: 24

  • Since: 2004/10/20


Thanks metropolis. Although I hav ethe Dave_L code to do what I need, it sounds like the module you mention could contain other useful blocks, etc. So I'll check it out. Thanks.

Mark (RIMark)

6
RImark
Re: How to display # of registered users in a block
  • 2006/8/17 0:50

  • RImark

  • Just popping in

  • Posts: 24

  • Since: 2004/10/20


Quote:

Dave_L wrote:
If you don't find that module, here's an example:

$member_handler =& xoops_gethandler('member');
$criteria  = new Criteria('level'1'>=');
$usercount $member_handler->getUserCount($criteria);
echo 
"Registered Users: $usercount";


How would i expand this to show:
Total registered users:
Users whose location == "RI":
Out of state users:

Seem like it would be simple enough, but what do I know?

Thanks!

Regards,

RImark

7
Dave_L
Re: How to display # of registered users in a block
  • 2006/8/17 11:38

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


$member_handler =& xoops_gethandler('member');

$criteria = new CriteriaCompo();
$criteria->add(new Criteria('level'1'>='));
$total_users $member_handler->getUserCount($criteria);
echo 
"Total registered users: $total_users";
echo 
'<br />';

$criteria->add(new Criteria('user_from''RI''='));
$ri_users $member_handler->getUserCount($criteria);
echo 
"Users whose location == 'RI': $ri_users";
echo 
'<br />';

$outofstate_users $total_users $ri_users;
echo 
"Out of state users: $outofstate_users";


The user_from condition above does an exact check for "RI". If you want to make it looser, you could use:

$criteria->add(new Criteria('user_from', '%RI%', 'LIKE'));

8
RImark
Re: How to display # of registered users in a block
  • 2006/8/18 2:48

  • RImark

  • Just popping in

  • Posts: 24

  • Since: 2004/10/20


Awesome Dave! Thanks very much.

Mark

9
Peekay
Re: How to display # of registered users in a block
  • 2006/8/18 9:29

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I found XM-Member Stats (on sourceforge) but... it's a 3 MB + module! About 2.8 MB of that is in the 'install' folder. That seems a bit overweight to display some stats in a block, or am I missing something?
A thread is for life. Not just for Christmas.

10
metropolis
Re: How to display # of registered users in a block
  • 2006/8/18 17:02

  • metropolis

  • Not too shy to talk

  • Posts: 159

  • Since: 2004/7/15


Why don't you look into that folder? The biggest part is an IP-to-country file. This file is not necessary for the module to work. If it is there, a flag of the country of the user's IP address will be displayed.

Login

Who's Online

158 user(s) are online (112 user(s) are browsing Support Forums)


Members: 0


Guests: 158


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits