The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
<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> |
#2
|
||||
|
||||
![]()
try "$vbulletin->db->query_read"
|
#3
|
||||
|
||||
![]()
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 |
#4
|
|||
|
|||
![]()
$this->registry->db->query_read()
or $this->dbobject->query_read() |
#5
|
||||
|
||||
![]()
I get these errors for each suggestion respectivly.
Quote:
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? |
#6
|
|||
|
|||
![]()
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. |
#7
|
||||
|
||||
![]()
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 |
#8
|
|||
|
|||
![]()
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() |
#9
|
||||
|
||||
![]()
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? |
#10
|
||||
|
||||
![]()
Would be more helpful to post what you have
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|