vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Where in the code is the post count increased? (https://vborg.vbsupport.ru/showthread.php?t=103175)

brownafroduck 12-18-2005 12:41 AM

Where in the code is the post count increased?
 
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.

merk 12-18-2005 01:26 AM

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.
Code:

                $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

Quote:

Originally Posted by brownafroduck
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.
Code:

                $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 ?

merk 12-18-2005 09:20 AM

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?
Quote:

Originally Posted by Zachery
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
Code:

$user->set_existing($this->info['user']);
Thanks sooo much for your help! :)


All times are GMT. The time now is 01:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01068 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete