Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 12-18-2005, 12:41 AM
brownafroduck brownafroduck is offline
 
Join Date: Oct 2003
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 12-18-2005, 01:26 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The function post_save_each_post() inside the vB_Datamanager_ThreadPost class.
Reply With Quote
  #3  
Old 12-18-2005, 08:41 AM
brownafroduck brownafroduck is offline
 
Join Date: Oct 2003
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 12-18-2005, 08:46 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Reply With Quote
  #5  
Old 12-18-2005, 09:20 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 12-19-2005, 06:27 PM
brownafroduck brownafroduck is offline
 
Join Date: Oct 2003
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:20 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.06611 seconds
  • Memory Usage 2,203KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete