|
|
Welcome to the Exploding Garrmondo Weiner Interactive Swiss Army Penis. |
GFF is a community of gaming and music enthusiasts. We have a team of dedicated moderators, constant member-organized activities, and plenty of custom features, including our unique journal system. If this is your first visit, be sure to check out the FAQ or our GFWiki. You will have to register before you can post. Membership is completely free (and gets rid of the pesky advertisement unit underneath this message).
|
|
Thread Tools |
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. Jam it back in, in the dark.
Last edited by Diversion; Dec 2, 2006 at 05:37 AM.
|
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.) Most amazing jew boots |
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!! This thing is sticky, and I don't like it. I don't appreciate it.
Last edited by Diversion; Dec 2, 2006 at 07:12 AM.
|
What's your vBulletin version?
Edit: No problem =D I am a dolphin, do you want me on your body? |
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? I was speaking idiomatically. |
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.
Most amazing jew boots |
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 FELIPE NO
Last edited by Diversion; Dec 2, 2006 at 10:07 AM.
Reason: Automerged additional post.
|