1
marcv
Displaying total number of registered users
  • 2006/11/1 20:59

  • marcv

  • Just popping in

  • Posts: 13

  • Since: 2006/5/18


Hello,

I am looking for a module or code just to show the total number of registered users on the homepage. I have tried a lot of statistic modules, but could not find the one I need.

Any ideas?

2
zyspec
Re: Displaying total number of registered users
  • 2006/11/1 22:13

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


All you have to do is create a custom block, tell XOOPS it is PHP code and then add the following code:
$num_members mysql_num_rows(mysql_query("SELECT uid FROM YOUR_XOOPS_TABLE_PREFIX_HERE_users WHERE level>0"));
echo 
"There are ".$num_members." active members.";


Just replace the "YOUR_XOOPS_TABLE_PREFIX_HERE" with your database table prefix (something like xoops_users, or 1U4PL_users, or whatever your MySQL database table name prefix is set to...).

3
Mithrandir
Re: Displaying total number of registered users

or use the frickin' API
$criteria = new Criteria('level'0'>');
$member_handler =& xoops_gethandler('member');
$active_users $member_handler->getUserCount($criteria);
echo 
$active_users;
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

4
marcv
Re: Displaying total number of registered users
  • 2006/11/1 23:31

  • marcv

  • Just popping in

  • Posts: 13

  • Since: 2006/5/18


Hello Zyspec & Mithrandir,

Thanks a lot for your help, this is exactly what I need, it works fine! Simple and plain, so that I can paste it anywhere on my site instead of adding another module.

Thanks, thanks, thanks!


Regards,


Marc

5
m0nty
Re: Displaying total number of registered users
  • 2006/11/1 23:55

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


i'd use Miths method tho, having sql queries in a block using mysql_query and totally unsanitized queries should be avoided at all cost, it's a very potential security threat which can possibly exploited exploited

6
fbs777
Re: Displaying total number of registered users
  • 2006/11/2 0:11

  • fbs777

  • Just popping in

  • Posts: 48

  • Since: 2005/1/9 4


I tryied both ways, but dont work in a php page in an existing block. How to include the total of members in a block from a module?

I want to put this with the members online module (actually, this is a block installed as a module )

7
DuGris
Re: Displaying total number of registered users
  • 2006/11/2 2:54

  • DuGris

  • Core Developer

  • Posts: 67

  • Since: 2004/3/14


You can use smarty plugin for XOOPS : LOOK HERE

tested with XOOPS 2.0.15

Documentation & Download

8
fbs777
Re: Displaying total number of registered users
  • 2006/11/2 18:19

  • fbs777

  • Just popping in

  • Posts: 48

  • Since: 2005/1/9 4


Hi, thank you, but dont work... im using the module "m_online", an alternative block for show more things, including the email (when authorized by user) avatar, in wich module the user is, and how much time the member are online.

You can see this module working here:
http://www.xoops.net.br/

He is the "Membros Online"

and download here:
http://www.xoops.net.br/modules/wfdownloads/singlefile.php?cid=6&lid=66

I want to make like this:
Old:
Members: 1

New:
Members: 1/100

The problem: this module dont have template, so the smarty dont work...

9
DuGris
Re: Displaying total number of registered users
  • 2006/11/2 22:07

  • DuGris

  • Core Developer

  • Posts: 67

  • Since: 2004/3/14


Look, that work

Resized Image Resized Image

10
McDonald
Re: Displaying total number of registered users
  • 2006/11/2 22:14

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Did you try XM-Memberstats?

http://www.xoopsmalaysia.org/download/singlefile.php?cid=2&lid=97


You can see it in action on the frontpage of Xoops Malaysia

Login

Who's Online

183 user(s) are online (106 user(s) are browsing Support Forums)


Members: 0


Guests: 183


more...

Donat-O-Meter

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

Latest GitHub Commits