vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   help me, users average posts (https://vborg.vbsupport.ru/showthread.php?t=44407)

khaleejy 10-08-2002 11:32 AM

help me, users average posts
 
hi :)
how can i know all users average posts???

thanks

Xenon 10-08-2002 11:34 AM

Huh?

can you explain what you meant by average posts?
Sorry, but i don't understand what you mean.

khaleejy 10-08-2002 11:40 AM

lets say that i have 3 users
the first user posts 2 messages on the forum only
the second user posts 1 messages on the forum only
the 3d user posts 5 messages on the forum

the average = (2 + 1 + 5) / 3 = 8 / 3 = 3 post per user

can me to do that??

Xenon 10-08-2002 12:48 PM

ahhh, i see

that wouldn't be a problem

where do you want to put it?

if you want to put it on the forumhomepage open index.php
find this:
PHP Code:

$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);

// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);

$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']); 

and below add this:
$avposts= round($totalposts/$numbermebers);

then you can use $avposts in your forumhome template

khaleejy 10-08-2002 01:31 PM

thank you
but i dont want to show it in the main page.. i want to show it admin/index.php (admin cp home page)
thats what ive done:
PHP Code:

<p><font size='1'>From here, you can control all aspects of your vBulletin forums.
Please select what you need from the links down the left hand side of this page.</font><p>

<?php

ive add below it the following:
PHP Code:

$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=$numbersmembers['users'];

$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=$countposts['posts'];

$avposts $totalposts $numbermebers;
$avposts round($avposts2);
echo 
"<br>Average users posts is (".$avposts.") per user"

but avposts will return to zero. and im getting this warning:
Warning: Division by zero

why it become zero??

Xenon 10-08-2002 03:45 PM

PHP Code:

$avposts $totalposts $numbermebers

you've forgotten an 'm' in $numbermembers ^^

khaleejy 10-08-2002 06:03 PM

thank you :) and sorry for this stupid mistake :knockedout:

Xenon 10-08-2002 09:32 PM

;)

you're welcome


All times are GMT. The time now is 07:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01035 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete