Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-21-2005, 04:11 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default userdata_postsave hook query

PHP Code:
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 100 WHERE userid = " $this->registry->userinfo['userid']); 
This query gives users impressions each time they make a new post. I would like to change it so that it gives a different amount of impressions according to whether it's a new post or a new thread. How would I go about doing this?
Reply With Quote
  #2  
Old 10-27-2005, 05:55 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any help on this? I have posted this twice now with no reply and it seems to be a simple fix. I just don't know the variabled to use for this hook.
Reply With Quote
  #3  
Old 10-27-2005, 06:12 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try checking the variable $type, I think that should be set to 'thread' or 'post'.
Reply With Quote
  #4  
Old 10-27-2005, 07:37 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i updated the hook from (which works)
PHP Code:
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 100 WHERE userid = " $this->registry->userinfo['userid']); 
to
PHP Code:
if ($type == "thread") {
    
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 100 WHERE userid = " $this->registry->userinfo['userid']);
} else if (
$type == "post") {
    
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 10 WHERE userid = " $this->registry->userinfo['userid']);

After updating it does nothing for posts and threads.
Reply With Quote
  #5  
Old 11-01-2005, 11:17 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can someone at least tell me which php document contains this hook so I can find the answer myself?
Reply With Quote
  #6  
Old 11-02-2005, 09:21 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry but i don't know the hook called 'userpost_datasave'.
Reply With Quote
  #7  
Old 11-08-2005, 08:43 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry it's userdata_postsave.
Reply With Quote
  #8  
Old 11-08-2005, 10:24 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A Hook "userpost_datasave" does not exist, at least not in standard vBulletin 3.5.1 code.
Reply With Quote
  #9  
Old 11-09-2005, 10:46 AM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well I found class_dm_user.hp thanks to Andreas, but after taking a look I couldn't find anything relevant to defining whether or not the post is a new thread or just a post. While functions_newpost.php does contain the variable $type which seems to store thread or reply it allways adds 10 (does the else) if I change:
PHP Code:
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 10 WHERE userid = " $this->registry->userinfo['userid']); 
To:
PHP Code:
if ($type == 'thread') {
    
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 100 WHERE userid = " $this->registry->userinfo['userid']);
} else {
    
$this->registry->db->query_write("UPDATE " TABLE_PREFIX "banners SET available = available + 10 WHERE userid = " $this->registry->userinfo['userid']);

Reply With Quote
  #10  
Old 01-05-2006, 09:35 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can anyone help me with this? I can't get it.
Reply With Quote
Reply


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 06:18 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04364 seconds
  • Memory Usage 2,271KB
  • Queries Executed 13 (?)
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
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete