The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Posts Per Week Statistic
Hello,
It's me again - so I'm looking to either create a plugin, or use whatever variables that are already available to somehow come up with a way to figure out a users post per week statistic. I am not really sure how to go about this. Any tips to point me in the right direction would be great. |
#2
|
||||
|
||||
If you are wanting to display this statistic on a user's profile page, then you could create a plugin as follows:
Product: vBulletin (or whatever product you wish this to be a part of) Hook Location: member_build_blocks_start Title: Compute Posts Per Week Execution Order: 5 Plugin PHP Code: PHP Code:
In the PHP Plugin Code, we are creating the number as part of the $prepared array since it is already registered there, and then using the number_format function to round it off to 2 decimal places to match the posts per day. Then, edit your "memberinfo_block_statistics" template by locating the code: HTML Code:
<dl class="blockrow stats"> <dt>{vb:rawphrase posts_per_day}</dt> <dd> {vb:raw prepared.postsperday}</dd> </dl> HTML Code:
<dl class="blockrow stats"> <dt>Posts Per Week</dt> <dd> {vb:raw prepared.postsperweek}</dd> </dl> |
#3
|
|||
|
|||
Thanks again Mark. I actually have another question, but I will create another thread.
For this though - I actually wanted to calculate it on a weekly basis. I made a new column in my user table, and added a hook to newpost_complete which +1 to the count. I then added a cron job to reset the count to 0 each week (based off of there having been activity in the account in the last week to cut down on database writes) |
#4
|
||||
|
||||
If you want a query that returns the number of posts made by a particular user during the last week, you could use:
PHP Code:
|
Благодарность от: | ||
CAG CheechDogg |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|