1
msxgamesbox
How to show number of users in a specific module?

I have a problem to a question that looked easy to implement but that is pulling my hair off... I hope somebody can help...

In my site theme, I would like to show in brackets the number of users currently located in a specific module
Concretely, I have a chatroom installed (Khat) but unless you go to that specific module, you don't know if somebody is in it. As my site is still very small, the chances to find somebody there is low so I'd like to implement a sort of simple mechanism that alerts visitors of the site when somebody is in the chatroom.


What I want to achieve (nothing else)
> Go to http://www.msxcafe.org - in the left bar you notice the 'Chat' button
> What to aim for is 'Chat (X)', where X is the number of user in that specific module.

Thanks in advance for the help!

2
ouioui
Re: How to show number of users in a specific module?
  • 2006/3/29 14:23

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


see the
function getCount($criteria = null)
in the file
..\kernel\user.php

3
msxgamesbox
Re: How to show number of users in a specific module?

I am really novice at this... I found in the user.php

Quote:

/**
* count users matching a condition
*
* @param object $criteria {@link CriteriaElement} to match
* @return int count of users
*/
function getCount($criteria = null)
{
$sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('users');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$sql .= ' '.$criteria->renderWhere();
}
$result = $this->db->query($sql);
if (!$result) {
return 0;
}
list($count) = $this->db->fetchRow($result);
return $count;
}


The module I want to get the value of users currently being in is http://www.msxcafe.org/modules/khat/

1) What do I need to put in the above code so it makes that count?
2) WHat code do I need to insert in my theme.htm so to display that count?

Thanks

4
msxgamesbox
[NOT SOLVED] How to show number of users in a specific module?

I have tried a number of things but as I have no experience in programming whatsoever I can't figure out what to do.
If somebody could explain step by step what I need to do to gets implemented, I would very much appreciate.

Thanks

Login

Who's Online

358 user(s) are online (302 user(s) are browsing Support Forums)


Members: 0


Guests: 358


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