Gamingforce Interactive Forums
85239 35211

Go Back   Exploding Garrmondo Weiner Interactive Swiss Army Penis > Garrmondo Network > Help Desk
Register FAQ GFWiki Community Donate Arcade ChocoJournal Calendar

Notices

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).


vBulletin Question
Closed Thread
 
Thread Tools
Diversion
Jellicle Cat


Member 68

Level 19.09

Mar 2006


Old Dec 2, 2006, 04:59 AM #1 of 7
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.
Bigblah
Tails is incompetent!


Member 5

Level 45.31

Feb 2006


Old Dec 2, 2006, 06:53 AM Local time: Dec 2, 2006, 07:53 PM #2 of 7
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
And then, to populate them initially,

Code:
UPDATE user SET totalposts = posts
From now on, the 'totalposts' field will be available through $vbulletin->userinfo['totalposts'], or $bbuserinfo['totalposts'] for templates. To update totalposts whenever someone successfully makes a post, you could use the Plugin Manager to add the necessary code to, say, the postdata_postsave plugin hook. (Doing this will also circumvent non-postcount forum behaviour.)

Code:
$this->dbobject->query_write("UPDATE " . TABLE_PREFIX . "user SET totalposts = (totalposts + 1) WHERE userid = " . intval($this->fetch_field('userid')));
I haven't tried it out myself, hopefully it works

(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
Diversion
Jellicle Cat


Member 68

Level 19.09

Mar 2006


Old Dec 2, 2006, 06:55 AM #3 of 7
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.
Bigblah
Tails is incompetent!


Member 5

Level 45.31

Feb 2006


Old Dec 2, 2006, 07:08 AM Local time: Dec 2, 2006, 08:08 PM #4 of 7
What's your vBulletin version?

Edit: No problem =D

I am a dolphin, do you want me on your body?
Diversion
Jellicle Cat


Member 68

Level 19.09

Mar 2006


Old Dec 2, 2006, 07:20 AM #5 of 7
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.
Bigblah
Tails is incompetent!


Member 5

Level 45.31

Feb 2006


Old Dec 2, 2006, 07:48 AM Local time: Dec 2, 2006, 08:48 PM #6 of 7
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
Diversion
Jellicle Cat


Member 68

Level 19.09

Mar 2006


Old Dec 2, 2006, 08:27 AM #7 of 7
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')));
Based off of what was written earlier, but it doesn't seem to select anything. Any idea what I may be doing wrong?

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.
Closed Thread


Exploding Garrmondo Weiner Interactive Swiss Army Penis > Garrmondo Network > Help Desk > vBulletin Question

Forum Jump


All times are GMT -5. The time now is 12:41 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.