vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   User's Percent of Total Posts (https://vborg.vbsupport.ru/showthread.php?t=32050)

apfeifer 11-02-2001 10:00 PM

Hack: User's Percent of Total Posts
Version of vB: 2.2.0, although may work on earlier versions but not tested
Current Version: 1.0.0
Description: This gives you a user's percent of the total posts on your forum.


Once again, this is a small hack but show's something interesting. Enjoy!

:cool:

apfeifer 11-03-2001 01:30 AM

Er, duh, helps if I attach the file...

03.11.01: Fixed issue with percent's on users with post count of over 1000, thanks FireFly!

LanciaStratos 11-03-2001 02:15 AM

Very nice hack! But, when I tried it out, it said that one of my users had 5988.52% of total posts. :?: :)

JJR512 11-03-2001 03:09 AM

Yeah, it looks like the results are 1000 times higher than what they should be.

For example, I have 9771 posts on a 116,395-post board. I have 8.39469% of the total posts. Yet it says I have 8423.28%. (It also looks like the rounding is off.)

MrLister 11-03-2001 03:47 AM

hmm well on popular boards the percent would be .02 % and so forth.... also it's a good idea to restrict the number of decimals.

apfeifer 11-03-2001 11:40 AM

Eek, sorry about that, I'll fix it as soon as I get home from tryouts.

:cool:

apfeifer 11-03-2001 12:20 PM

Quote:

Originally posted by JJR512
Yeah, it looks like the results are 1000 times higher than what they should be.

For example, I have 9771 posts on a 116,395-post board. I have 8.39469% of the total posts. Yet it says I have 8423.28%. (It also looks like the rounding is off.)

Hmm, I just plugged the numbers for your posts / your boards posts in and it worked fine:

PHP Code:

$percentoftotalposts round((9774  116429) * 100,2);

echo 
$percentoftotalposts

That echo's: 8.39

So I'm not totally sure. Paste the exact code that you have in member.php (just those couple lines, of course:p), and I'll look them over. I don't really see anything to fix because it's working for me.

:cool:

Admin 11-03-2001 12:23 PM

Code:

  $totalposts=number_format($countposts['posts']);
should be
Code:

  $totalposts=$countposts['posts'];
because number_format() adds commas to the number (i.e 1000 => 1,000).

apfeifer 11-03-2001 03:07 PM

Thank's FireFly! I have uploaded the fixed version of it.

:cool:

toLTcaboLT 11-03-2001 03:21 PM

Hmzz I know it's little stupid .. but when I install where I can see that info ? :)

Can someone post screenshot .. I wanna too see that Hack .. Please? Tnx

apfeifer 11-03-2001 03:27 PM

Here ya go:

https://vborg.vbsupport.ru/attachmen...862&fullpage=1

toLTcaboLT 11-03-2001 03:34 PM

Cool .. Tnx man :)

LanciaStratos 11-03-2001 03:36 PM

Working great now. Thanks apfeifer and FireFly! :)

JJR512 11-03-2001 03:42 PM

First, thanks to FireFly; that fixed my problem.

Next, I'd like to show how I took the basic idea of this hack and extended it to work with tubedogg's 'user has started xx threads' hack (which was my idea ;)). This hack adds a new line to a person's profile, below the person's post count (and now the post percentage count, with this hack), and shows how many threads a person has started. What I've done is taken the idea of this hack, interfaced it with tubedogg's hack, to display the percentage of total threads that a person has started.

1. Install this hack
2. Install tubedogg's hack from here, only instead of adding the contents of his memberadd.txt file where he tells you to in his step #2, insert the contents of that file just above the bit you added from this hack.
3. Below the bit you added to member.php from this hack, add this:
Code:

// Find percentage of threads started
$counttotalthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=$counttotalthreads['threads'];
$percentageoftotalthreads = round(($starts / $totalthreads) * 100,2);

4. In the getinfo template, assuming you have already added the contents of getinfoadd.txt from tubedogg's hack, find $starts and change it to $starts ($percentageoftotalthreads% of total threads).

I would like to get permission from apfeifer and tubedogg to re-release their individual hacks along with my modifications as one unified hack (with full crediting, of course).

apfeifer 11-03-2001 03:44 PM

Me likes!

:cool:

Admin 11-03-2001 03:45 PM

No problems. :)
I installed this here, it's cool to have. :pleased:

GeorgeofCS 11-03-2001 03:57 PM

I got it to work, but I did have a problem in this line

$percentoftotalposts = round(($userinfo[posts] / $totalposts) * 100,2);

it wouldn't work so I had to change it to

$percentoftotalposts = round(($userinfo[posts] / $totalposts) * 100);

but for me it doesn't give decimals.

Admin 11-03-2001 04:04 PM

What version of PHP are you using George?

Admin 11-03-2001 04:16 PM

http://www.vbulletin.com/forum/showt...threadid=32024

Try to use this:
Code:

$percentoftotalposts=sprintf('%.2f', (($userinfo[posts] / $totalposts) * 100);

GeorgeofCS 11-03-2001 04:33 PM

Unfortunately I'm on php 3.16 I think. I'd have to check on the actual version number.

That replacement string didn't work :(

Admin 11-03-2001 04:39 PM

Ooops, sorry. Did a typo. :o
Try again. :)

GeorgeofCS 11-03-2001 05:02 PM

well that didn't work at first, but I found another typo and it works now with

$percentoftotalposts = sprintf('%.2f', (($userinfo[posts] / $totalposts) * 100));

Thank you :)

apfeifer 11-04-2001 09:08 PM

Glad to see you got it working!

Should I change the documentation so it is compatible with older versions of PHP?

:cool:

eva2000 11-04-2001 10:02 PM

:cool:

KuraFire 11-05-2001 10:57 PM

I've got this installed, thanks man, nice hack! ^_^

over 11-09-2001 08:37 PM

nice hack :) thnx
couple of days ago i spent ages gettin some stats sorted for the top 10 posters :) gonna slightly modify it if thats ok with u to show % on the topposters script.

Sweet Evil 11-14-2001 05:00 AM

Yet another nice little feature by apfeifer, Thanks! ;)

punkbull 11-17-2001 12:54 PM

I'm getting this error at the top of my forum's profile page:

Quote:

Warning: Division by zero in /home/punkbull/public_html/member.php on line 1151
The user has no posts... I noticed that this is not happening with the vBulletin.org forums... I'm using the code straight from that text file. Any ideas?

Sweet Evil 11-17-2001 02:22 PM

What is you line 1151?

Mine has nothing to do with this edit.. but talks about Moderators..

Did you install another hack at the same time as this one?

If I ever have a problem, I like to take Araxis Merge 2001 Professional and open my file thats having problems and a orig.. from the zip file.... to see what could be wrong..

punkbull 11-17-2001 11:08 PM

Ahh, it was because there were no threads on the entire board ;)

Thank you!

Sadie Frost 01-11-2002 11:51 AM

Great hack!

Could someone help me figure out how to put this in my forumhome? I tried just inserting the "$percentoftotalposts% of total posts" but when I do that all I get is "% of total posts". Am I doing something wrong?

Thanks for your help! :)

69-FLy-gUy 01-22-2002 06:10 AM

You mean the postbit template when you make a post?

If so.. I am wondering how to also..

I palced the contents in showthread.php, but when i did, it made the pages 427 pages long for some reason...

Any help??
Ciao

inetd 05-05-2002 06:04 AM

[high]* inetd installed this hack
[/high]
Good hack! :)

inetd 05-05-2002 06:07 AM

Quote:

Originally posted by Sadie Frost
Great hack!

Could someone help me figure out how to put this in my forumhome? I tried just inserting the "$percentoftotalposts% of total posts" but when I do that all I get is "% of total posts". Am I doing something wrong?

Thanks for your help! :)

Sadie, you must add this code
Code:

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

  $percentoftotalposts = round(($userinfo[posts] / $totalposts) * 100,2);

in index.php
after this
Code:

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

And add $percentoftotalposts% of total posts in forumhome template :)

GL!

Eniyi 05-16-2002 01:28 PM

Which file am I supposed to edit to put the percentage in the postbit?

Broekie 05-16-2002 02:38 PM

to also get the threads per day (assuming you've installed this hack and tubedog's hack according to this info: https://vborg.vbsupport.ru/showthrea...068#post198068)

in member.php

FIND
PHP Code:

  $jointime = (time() - $userinfo[joindate]) / 86400// Days Joined
  
if ($jointime 1) { // User has been a member for less than one day.
    
$postsperday "$userinfo[posts]"

ADD DIRECTLY UNDER THAT
PHP Code:

$threadsperday "$starts"

FIND
PHP Code:

    $postsperday sprintf("%.2f",($userinfo[posts] / $jointime)); 

ADD DIRECTLY UNDER THAT
PHP Code:

    $threadsperday sprintf("%.2f",($starts $jointime)); 

save and upload

than, in the getinfo template
REPLACE
PHP Code:

$starts ($percentageoftotalthreadsof total threads

WITH
PHP Code:

$starts ($threadsperday threads per day $percentageoftotalthreadsof total threads

and it should work fine :)

PS: see the screenie to see what I mean ;)

FleaBag 05-16-2002 11:20 PM

Installed on 2.2.5. Thanks for this hack!

Velocd 05-19-2002 02:55 PM

For the users with low posts, their percentage seems to be accurate, but for some reason I and others with high posts are getting a percentage over 100, see attachment:

Broekie 05-20-2002 06:32 AM

Quote:

Originally posted by Velocd
For the users with low posts, their percentage seems to be accurate, but for some reason I and others with high posts are getting a percentage over 100, see attachment:
Looks like you've got an old version of this hack (that old version had this problem)

just read the first few posts, and see if that can help you...

Eniyi 05-22-2002 02:06 PM

I guess my question was missed.

How can I display this percentage in the postbit?


All times are GMT. The time now is 03:51 AM.

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.01386 seconds
  • Memory Usage 1,826KB
  • 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
  • (6)bbcode_code_printable
  • (7)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete