vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   userdata_postsave hook [PLEASE HELP] (https://vborg.vbsupport.ru/showthread.php?t=105763)

Nullifi3d 01-19-2006 10:56 PM

userdata_postsave hook [PLEASE HELP]
 
I managed to temporarily fix this by using different hooks and code, but now I have 3 different hooks for what could be done with one (I think).
- ajax_complete
- newreply_post_complete
- newthread_post_complete

Can anyone fix the code below to work with userdata_postsave (or another 1 hook solution):
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']);


I am trying to update a mysql table with two different decimal values depending on whether the post is a reply or a new thread.

Marco van Herwaarden 01-20-2006 10:58 AM

userdata_postsave is called whenever member/user information is changed, like when changing a profile.

The 'post' means that it is called after the new data is saved to the database. The 'presave' versions are called before data is written to the database.

This hook has nothing to do with posting.

Nullifi3d 01-20-2006 12:07 PM

Andreas suggested that I use userdata_postsave instead of newpost_complete.

Edit: I changed the hook to newpost_complete and modified the variables in the query to make it work. Thread solved.


All times are GMT. The time now is 06:25 AM.

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.00940 seconds
  • Memory Usage 1,714KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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