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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2008, 06:34 PM
RobDog888's Avatar
RobDog888 RobDog888 is offline
 
Join Date: Apr 2007
Location: Degabah Swamp
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Requires with plugin

<font color="darkgreen">I am trying to add additional content to the postbit template conditionally and pulling in a template bit with the php code in a requires statement in the plugin.

Usually not a problem but Im getting errors when I try to call a "$db->query_read( blah, blah " statement. Says object null or required.

Even with a single line of code in my requires php page I get the $db is null. What could be the issue?

Im using showthread_postbit_create or postbit_start hook location(s) as either will generate the same error.

Thanks</font>
Reply With Quote
  #2  
Old 01-28-2008, 06:37 PM
Andrew Green's Avatar
Andrew Green Andrew Green is offline
 
Join Date: Nov 2005
Location: Winnipeg, MB
Posts: 996
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try "$vbulletin->db->query_read"
Reply With Quote
  #3  
Old 01-28-2008, 06:56 PM
RobDog888's Avatar
RobDog888 RobDog888 is offline
 
Join Date: Apr 2007
Location: Degabah Swamp
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the quick reply.

I still get a ...
Code:
Fatal error: Call to a member function on a non-object in .... forums/includes/class_postbit.php(268) : eval()'d code on line 9
Line 9 in the plugin is "$vbulletin->db->query_read("" as I commented out the requires to simplify things and moving it all into the plugin for testing only.
Reply With Quote
  #4  
Old 01-28-2008, 07:14 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$this->registry->db->query_read()

or

$this->dbobject->query_read()
Reply With Quote
  #5  
Old 01-28-2008, 07:28 PM
RobDog888's Avatar
RobDog888 RobDog888 is offline
 
Join Date: Apr 2007
Location: Degabah Swamp
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get these errors for each suggestion respectivly.

Quote:
Fatal error: Call to undefined method: vb_registry->query_read()

Fatal error: Call to a member function on a non-object
--------------- Added [DATE]1201556097[/DATE] at [TIME]1201556097[/TIME] ---------------

postbit_display_start is in the class_postbit.php which is not really where I think I should be using for the location hook but it works when I dont execute a query.

The construct_postbit is the function where that hook is located. Couldit be possible that the location of the hook is the issue?
Reply With Quote
  #6  
Old 01-28-2008, 07:42 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll take a look at the file in a sec. but just to check did you use:

$this->registry->db->query_read()

Because according to your error I'm guessing you did $this->registry->query_read() which isn't correct.
Reply With Quote
  #7  
Old 01-28-2008, 07:47 PM
RobDog888's Avatar
RobDog888 RobDog888 is offline
 
Join Date: Apr 2007
Location: Degabah Swamp
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I changed it and retested it and same error.

$myvar = $this->registry->db->query_read("SELECT * FROM Table1");



Thanks I appreciate all the help guys

Ps, I changed the hook location to "showthread_post_start" but still errors but I think thats the best hook
Reply With Quote
  #8  
Old 01-28-2008, 07:54 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In showthread_... you should be able to use $vbulletin->db->query_read() or $db->query_read().

As a last resort you can try $GLOBALS['vbulletin']->db->query_read()
Reply With Quote
  #9  
Old 01-28-2008, 08:08 PM
RobDog888's Avatar
RobDog888 RobDog888 is offline
 
Join Date: Apr 2007
Location: Degabah Swamp
Posts: 293
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some weird reason the plugin wont display static text with showthread_post_start but it does with postbit_display_start.

I tried your latest suggestion $GLOBALS['vbulletin'] and it worked! I got a simple query to run and display the number of records returned in the postbit template with postbit_display_start. Thanks a million

I dont know why I have to use the hook in the class_postbit.php file but maybe it has to do with order of execution or something?
Reply With Quote
  #10  
Old 01-28-2008, 08:22 PM
sinisterpain's Avatar
sinisterpain sinisterpain is offline
 
Join Date: Feb 2006
Location: New Hampshire
Posts: 571
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would be more helpful to post what you have
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 03: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.03914 seconds
  • Memory Usage 2,249KB
  • 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
  • (1)bbcode_code
  • (1)bbcode_quote
  • (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_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