The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
I'd like to have a feature in people's profiles that show the average words per post for that user. Our forums top posters pride themselves in long, meaningful posts, yet we still have people who have yet to post more than a sentance per post. Is there a way one could code in an averageing system that counts the words per post and display that in their profile? The math is easy enough, it's just finding out how many words are in each post that comes as a challenge to me.
Anyone want to help out here? It would be greatly appretiated! |
#2
|
||||
|
||||
You might look at this function:
http://www.php.net/manual/en/function.strtok.php This would help you get the count of the number of words in the message field. Then, you would need a new field in your database for total number of words posted. The problem is, users who already have a lot of posts aren't going to have accurate averages unless you create two new fields in the database. One for total words, one for number of posts made since the hack was installed. Hope that helps you get started. Amy |
#3
|
|||
|
|||
Well, my idea was this:
Find some way of taking a users post count, and then going in the post database and for userid=$userid tossing the posts into an array, and then for each post find the wordcount, += it to a var, and then divide by total posts. I'm not sure how intensive that would be on the database, probably equal to or worse than a search is. It would be ideal I suppose if it automatically added a field to post for each post, but that would require far more hacking, and scripting something for their previous posts. |
#4
|
|||
|
|||
Here's the quick script I wrote up, works pretty well from what I can tell, although it is somewhat slow for users with high post counts (although my server is only a P200, it's slow in its old age)
PHP Code:
|
#5
|
|||
|
|||
Where do you put this code? I'm really interested in implementing this into my board. I wanted to add this to the postbit under the number of posts for the user. Would that be to server intensive?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|