xoops forums

vinit

Just can't stay away
Posted on: 2004/9/19 19:03
vinit
vinit (Show more)
Just can't stay away
Posts: 530
Since: 2004/1/10
#1

How to show the count of registered members on homepage?

Hi i want show the following details on homepage with help of a module.

1. Active members
2. Incactive members.
3. Total number of members visited on a given day.
4. Number of members not visited in last 30 days and many such information about members in a module. Do we have any such module available. if now can anyone tell me what queries we need to do to get those datas, i will try to add a module with those datas. Thanks in advance for all your help endevaoured in this regard.

wcrwcr

Home away from home
Posted on: 2004/9/19 19:12
wcrwcr
wcrwcr (Show more)
Home away from home
Posts: 1114
Since: 2003/12/12
#2

Re: How to show the count of registered members on homepage?

Any of the stats modules don?t have any of these functions?

Bender

Home away from home
Posted on: 2004/9/19 22:49
Bender
Bender (Show more)
Home away from home
Posts: 1899
Since: 2003/3/10
#3

Re: How to show the count of registered members on homepage?

Use the search and check only into threads not older than 3 weeks. I am pretty sure someone from the regular posters mentioned at least some of this being in one module.

If memory serves me well it was in a thread about the who´s online block. Not too sure though ...

vinit

Just can't stay away
Posted on: 2004/9/21 7:18
vinit
vinit (Show more)
Just can't stay away
Posts: 530
Since: 2004/1/10
#4

Re: How to show the count of registered members on homepage?

searching for it hopefully will get it somewhere.. meanwhile if you get the link do post it back here or pm me thanks in in advance.

Mithrandir

XOOPS is my life!
Posted on: 2004/9/21 9:23
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#5

Re: How to show the count of registered members on homepage?

$member_handler =& xoops_gethandler('member');
$total_active_users $member_handler->getUserCount(new Criteria('level'0'>'));
$total_inactive_users $member_handler->getUserCount(new Criteria('level'0'='));
$users_within_thirty_days $member_handler->getUserCount(new Criteria('last_login'time()-(30*24*3600), '>='));
$users_with_more_than_thirty_days $member_handler->getUserCount(new Criteria('last_login'time()-(30*24*3600), '<'));

iolai

Quite a regular
Posted on: 2004/9/21 10:53
iolai
iolai (Show more)
Quite a regular
Posts: 206
Since: 2004/6/26
#6

Re: How to show the count of registered members on homepage?

Could you provide more information about the "Criteria('level', 0, '>')" part? IE explain it...

solo71

Module Developer
Posted on: 2004/9/21 11:54
solo71
solo71 (Show more)
Module Developer
Posts: 941
Since: 2003/1/29
#7

Re: How to show the count of registered members on homepage?

Blockutils in the Wolf XOOPS Pack.

Posted on: 2004/9/21 12:20
ackbarr
ackbarr (Show more)
Posts: 1449
Since: 2002/10/2
#8

Re: How to show the count of registered members on homepage?

Criteria is an object provided by the core to specify which records to retrieve. It has a big brother in the CriteriaCompo object.
Most database handlers provided in XOOPS utilize these objects to provide a consistant mechanism of retrieving records from the db.
The code:
new Criteria('level'0'>')

creates a new criteria object and passes 'level', 0, and '>' as parameters to the object's constructor function.

Simply we are telling the database to return the number of user records WHERE level > 0. Those that have worked with SQL queries in the past will be familiar with this construct. XOOPS stores a value in the {your_prefix}_users table, level, with the following values:
0 - user has registered but not confirmed registration
1 - user has confirmed registration




iolai

Quite a regular
Posted on: 2004/9/21 14:17
iolai
iolai (Show more)
Quite a regular
Posts: 206
Since: 2004/6/26
#9

Re: How to show the count of registered members on homepage?

Ahh, thank you very much!

Another question. I want to make a table in which I show the following data:

User name | User rank

This code will retrieve all the active users:
$member_handler =& xoops_gethandler('member');
$total_active_users = $member_handler->getUserCount(new Criteria('level', 0, '>'));

How do I create and display the code that will display all the users?
Posted on: 2004/9/21 18:51
ackbarr
ackbarr (Show more)
Posts: 1449
Since: 2002/10/2
#10

Re: How to show the count of registered members on homepage?

well getUserCount only returns the count of users, but
$users =& $member_handler->getObjects(new Criteria('level'0'>'));

will return all the user objects for users that are active. Then you can loop through the returned users like so:
foreach($users as $user) {
  echo(
$user->getVar('uname') . ' | ' $user->getVar('rank') . '<br />');
}