vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Using the Database object in the postbit_display_complete hook (https://vborg.vbsupport.ru/showthread.php?t=299015)

dushan26 06-12-2013 12:50 AM

Using the Database object in the postbit_display_complete hook
 
I'm trying to select something from the database in the postbit_display_complete hook using the database object. I am able to successfully access it using the following syntax:

vB::$db->query_read_slave(...

The problem is I cannot use this syntax in vBulletin 3.7, and I want the product I am making to work in both versions. What I want to do is use:

$vbulletin->db->query_real_slave(...

However with this syntax I am getting the error, "Fatal error: Call to a member function query_read_slave() on a non-object in..."

I find this strange because I am able to use the $vbulletin object just fine in the newpost_process hook.

Any help would be greatly appreciated. Thanks in advance.

Lynne 06-12-2013 01:15 AM

Why does it have to be the same for 3.7 and 4.x? Your template syntax will most likely not be the same at all.

dushan26 06-12-2013 01:18 AM

It would be nice if it was all one file, at the moment that is the only piece that needs to be fixed, otherwise it works in both versions.

Lynne 06-12-2013 01:32 AM

In my vB4 mods, with that hook, I use:

$this->registry->db->query_read_slave

so perhaps that will work with both versions.


All times are GMT. The time now is 10:49 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.00964 seconds
  • Memory Usage 1,707KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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