Announcement

Collapse
No announcement yet.

undefined method db::query_first_slave() in class_dm_threadpost.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • undefined method db::query_first_slave() in class_dm_threadpost.php

    Hi,

    Version = 3.8.4 (PL1)

    I am attempting to use the data manager to create a new thread in the forums. A user add an entry to an external calendar and I want to create a new thread in the forums for the external calendar entry.

    I have some test code (attached, test.php) that has vBulletin data manager code only and that works fine. The thread is successfully added to the database.

    When I insert this code into my calendar php script, the following fatal error is recorded in the logs, when the script is run ...

    PHP Fatal error: Call to undefined method db::query_first_slave() in [forums path]/includes/class_dm_threadpost.php on line 74

    Can anyone point me to where I can further analyse and resolve this?
    Attached Files

  • #2
    When I insert this code into my calendar php script, the following fatal error is recorded in the logs, when the script is run ... [...]
    How are you including it in your script ?

    Make sure the call to include global.php is outside any function.
    (This applies even when you include global.php in an external file, which in turn is included via a function)

    PHP Code:
    // Fails.

    function foo_bar()
    {
        
    // ...
        
    require_once(CWD '/global.php');
        
    // ...

    Btw, it's better to open a thread at vb-org;
    since this is custom coding which isn't supported here on vb-com.
    The joy of an early release lasts but a short time. The bitterness of an unusable system lasts for years.
    GeekPoint Forum | Articles & Reference

    Comment


    • #3
      Originally posted by Shadab View Post
      How are you including it in your script ?

      Make sure the call to include global.php is outside any function.
      (This applies even when you include global.php in an external file, which in turn is included via a function)
      Thanks for the response, yes it's outside an function ...

      PHP Code:
      <?
      error_reporting
      (E_ALL);
      session_start();


      require_once(
      $_SERVER['DOCUMENT_ROOT'] . "/include/common.inc");
      require_once(
      $_SERVER['DOCUMENT_ROOT'] . "/include/functions.inc");
      require_once(
      "include/config.php");

      // connect to the database
      $conn mysql_connect($db_host$db_user$db_passtrue) or die("Could not connect to database!");
      mysql_select_db($db_name$conn);

      // Statements for vBulletin insert
      $forums_path $_SERVER['DOCUMENT_ROOT'] . '/forums';
      define('VB_AREA''External');
      define('SKIP_SESSIONCREATE'1);
      define('SKIP_USERINFO'1);
      define('CWD'$forums_path);
      require_once(
      CWD '/global.php');
      require_once(
      CWD '/includes/class_dm.php');
      require_once(
      CWD '/includes/class_dm_threadpost.php');
      require_once(
      CWD '/includes/functions_databuild.php');
      // Statements for vBulletin insert
      ?>

      <html>
      <head>
      [...]

      Originally posted by Shadab View Post
      Btw, it's better to open a thread at vb-org;
      since this is custom coding which isn't supported here on vb-com.
      Oh,ok. I thought since it was an error with vBulletin core, coming from vBulletin library that it belonged in here.

      Thanks.

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X