The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Based on Post Count
I'm wanting to create a template edit on my sports forum for "MLB ERA" - The more the member posts the lower the ERA goes down.
If you do not know what MLB ERA is: http://www.ehow.com/how_9733_calculate-earned-run.html What would I need to do to accomplish this? |
#2
|
|||
|
|||
It sounds like it's very similar to "posts per day" that this site displays, except lower is better. So I guess you'd have to figure out how you want to calculate that. I suppose you could do something like decide that N or more posts per day is "perfect", then calculate the number of posts per day for a user and subtract from N (although then anyone with N or more posts per day would have an "era" of 0, so maybe you need something like 1/PPD instead?).
As for actually implementing it, you'd probably need a plugin to calculate it. If you only want to display it in the postbit then you could use postbit_display_complete and use the values in $post (which should contain the author's data), and set $post['era'] or something like that. |
#3
|
|||
|
|||
Thanks kh99! Seems like a very simple task, but I'm a beginner so I'll need a little help.
Will you help me with the plugin, as I'm not sure. |
#4
|
|||
|
|||
I think it's probably only a few lines so I could do that, if you can tell me exactly how you want to calculate it. Do you want it to be a "lifetime" value? Hopefully that's OK because it's easy enough to get the time since a user joined and the total posts since they've joined, otherwise it gets more difficult. But one issue with it being a lifetime value is that it of course gets harder and harder to change as time goes on.
|
#5
|
|||
|
|||
Yes lifetime value is okay - anything that's easy enough for you. Just make it go along with the ERA, the link I posted above. This will be greatly appreciated!
|
#6
|
|||
|
|||
kh99, I'm not replying to disturb you if you're busy but about long will it take you to get the plugin done? I'm interested in adding this asap. Thanks much!
-Justin |
#7
|
|||
|
|||
It's OK, it's good to remind me. But I had been hoping you'd specify how you wanted it calculated. The plugin's not an issue, it's figuring out the equation. Like I mentioned above, it doesn't really translate exactly because with era low is good. If you picked a certain number of posts per day or week that you wanted for someone to be "perfect" then a lot of people would probably have 0.00, which I figured you wouldn't want.
I can probably figure out something that works but I need to think about it. |
#8
|
||||
|
||||
What does "Earned Run Average" mean in MLB? I'm from Europe and only watch Football
|
#9
|
|||
|
|||
Thanks kh99!
per predictem Quote:
mokujin, ERA or earned run average, is another way of saying "what a pitcher gives up per nine innings that he pitches." |
#10
|
|||
|
|||
I was hoping mokujin might decide to come up with something. Anyway, it's actually a pretty simple plugin, you just need to create a new plugin using hook postbit_display_complete and code something like:
Code:
if (!$post['posts']) $post['era'] = "No Posts Yet"; else { $days = $post['joindateline'] / (3600 * 24); // 3600 * 24 = seconds in a day $era = $days / $post['posts']; $post['era'] = vb_number_format($era, 2); } Then use {vb:raw post.era} in your postbit or postbit_legacy template. This just uses 1/posts per day so that lower is "better", but I'm kind of guessing that's going to give values for some users that don't look like reasonable ERA values, so you'll probably want some tweaking. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|