![]() |
vBulletin Question
I have a question about vBulletin post count. I noticed that it has only been counting total posts still in the database on my own forums. So if I were to purge an old board, most post counts would go down. Now for most post count doesn't matter, but for functional purposes of the board (a level system very similar to the one we have here), I would like to try to have it keep track of total posts ever made, whether it's still in the database or not. Any idea how to adjust this?
Thanks in advance. Edit: I checked the database and noticed that there is a "post" column which outlines a user's post count. Instead of querying total posts, it just updates this post counter whenever posts are deleted, so just need to find an option to disable that negative increment. |
A better way would be to add a new field to the user table instead -- this way you don't end up modifying original forum behaviour. Assuming your vBulletin tables have no prefix, you could run this query:
Code:
ALTER TABLE user ADD totalposts int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER posts Code:
UPDATE user SET totalposts = posts Code:
$this->dbobject->query_write("UPDATE " . TABLE_PREFIX . "user SET totalposts = (totalposts + 1) WHERE userid = " . intval($this->fetch_field('userid'))); (Note: the database object above corresponds to vBulletin 3.5x, you should check if your own install has the same syntax.) |
About to give it a try in a moment, I'll post results. Thank you!
Edit: I got the hook in there, found everything right, and I didn't get a syntax error of any kind. When I checked the database, the regular post count would update, but total wouldn't. I'll keep working with this through the day. If you happen to see what it may be, let me know. Thanks again! Edit 2: Nope, it did work, I just added a quote in there for some odd reason: works perfectly. Thank you!! |
What's your vBulletin version?
Edit: No problem =D |
Actually, if I may, I have one more question.
I had originally written a hack for IPB 2 years back which basically created an RPG-based aesthetic to the side. vBulletin definitely has a much different approach to coding (I'll attach the old code: it's VERY crude). It was basically a function of the total post count which ran through a bunch of different math functions to create the final 3 bars, though for true RPG fans the bars bear no usefulness whatsoever. Would it be within the plugins section that I should put this mod (I will recode to fit vB) so that it'll execute with each post? |
Yeah, a common hook location to use would be postbit_display_complete. The totalposts value (specific to each postbit) should be available as the $post['totalposts'] variable.
|
Awesome, thanks again, gonna tweak with it and see what I come up with!
Edit: Going to throw one more question out there. If I want, within this function, to set a variable equal to an item in the database, I tried: Code:
$this->dbobject->query("SELECT totalposts FROM user WHERE userid = " . intval($this->fetch_field('userid'))); Double Post: Bigblah is my vB hero! <3 |
All times are GMT -5. The time now is 08:50 AM. |
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2025, vBulletin Solutions, Inc.