View Full Version : Where in the code is the post count increased?
brownafroduck
12-18-2005, 12:41 AM
In which file and where is the code that increases the user's post count when he or she posts?
I have a second field in the user database that I want to increment by 1 when users post.
The function post_save_each_post() inside the vB_Datamanager_ThreadPost class.
brownafroduck
12-18-2005, 08:41 AM
So how would I make it increment a field in the user table called money each time a user posts? It seems that it should be something like this, but I have minimal knowledge of php & mySQL.
$money = $this->fetch_field('money', 'user');
$user->set('money', 'money + 1');
I don't fully understand what all that code means. I've used the code in the other classes as examples when I came up with that.
Zachery
12-18-2005, 08:46 AM
So how would I make it increment a field in the user table called money each time a user posts? It seems that it should be something like this, but I have minimal knowledge of php & mySQL.
$money = $this->fetch_field('money', 'user');
$user->set('money', 'money + 1');
I don't fully understand what all that code means. I've used the code in the other classes as examples when I came up with that.
ANy reason you don't want to use uCash ?
You are unable to do it using that method. You will need to add money to the validfields array (see vbulletin documentation), and then you can just set, no need to use fetch_field at all.
brownafroduck
12-19-2005, 06:27 PM
Yeah I added it to the validfields array, but when I post, nothing happens. The "money" count doesn't increase. Perhaps I am putting it in the wrong part of the file? I am putting it right below the post count increase line. Where should I be putting it?
ANy reason you don't want to use uCash ?
It has way more options than I want. I had it installed on my previous version of vBulletin, but now that I'm upgrading, I want something simple. Although I have very little knowledge of php/mySQL interaction, I want to do it myself. I really want to learn more about how vBulletin works, and I figure that little stuff like this will help.
EDIT: I got it. I placed it on line 616 below$user->set_existing($this->info['user']);
Thanks sooo much for your help! :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.