1
jack_buu7
Display total users and phpbb total posts in block
  • 2005/5/24 4:22

  • jack_buu7

  • Just popping in

  • Posts: 3

  • Since: 2005/5/24


i noticed some people are looking for these codes. so i decided to post here.

you can create as a block in xoops. must be php script. already tested and worked with phpbb forum module for xoops.

Thanks to UseLess from phpbbstyles.com for sql part.

here it is

$member_handler =& xoops_gethandler('member');

$total_members $member_handler->getUserCount(new Criteria('level'0'>=')); // this will display total users
$total_active_members $member_handler->getUserCount(new Criteria('level'0'>'));   // this will display active users
$total_inactive_members $member_handler->getUserCount(new Criteria('level'0'=')); //this will display inactive users

$dbhost 'localhost';  // database host
$dbname '';           // database name
$dbuser '';           // database username
$dbpasswd '';         // database password
 
$table_prefix 'xoops_pbb_'// this is phpbb module table for xoops
 
$db_link mysql_connect($dbhost,$dbuser,$dbpasswd);  
 
if( !
$db_link )  
{  
   die(
'Unable to connect to db server');  
}  
 
if( !
mysql_select_db($dbname) )  
{  
   die(
'Unable to select db: ' $dbname);  
}  
 
$sql "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total  
   FROM " 
$table_prefix "forums";  
 
 
$result mysql_query($sql);  
 
if( !
$result )  
{  
   die(
'Error: ' mysql_errno() . ': ' mysql_error() . ' SQL: ' $sql );  
}  
 
$info mysql_fetch_array($result);  
 


echo 
"Total Members : ".$total_members;
echo 
"
Total Active Members : "
.$total_active_members;
echo 
"
Total Inactive Members :"
.$total_inactive_members;
echo 
'
Total Topics : ' 
$info['topic_total'];  
echo 
'
Total Posts : ' 
$info['post_total'];


it should display like this
.............................
Total Members : 1234
Total Active Members : 1200
Total Inctive Members : 34
Total Topics : 65
Total Posts : 2500
.............................

i just wrote the codes in here again.. so if there are problems, let me know..

hope this help..

2
hervet
Re: Display total users and phpbb total posts in block
  • 2005/5/24 19:24

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


May be you could suggest it in the FAQ ?

3
jack_buu7
Re: Display total users and phpbb total posts in block
  • 2005/5/25 0:19

  • jack_buu7

  • Just popping in

  • Posts: 3

  • Since: 2005/5/24


anywhere u want dude :)

Login

Who's Online

487 user(s) are online (54 user(s) are browsing Support Forums)


Members: 0


Guests: 487


more...

Donat-O-Meter

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

Latest GitHub Commits