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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-11-2009, 08:19 AM
mouth mouth is offline
 
Join Date: Jun 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 that has vBulletin data manager code only and that works fine. The thread is successfully added to the database ....

PHP Code:
<?
// 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>
<title>Events Calendar</title>
<link rel="stylesheet" type="text/css" href="/style.css">
</head>
<body>

<?
/* --- Insert calendar item into vBulletin forums --- */
// Statements for vBulletin insert - Refer to statements at the top of this page
$userid = 1;
// pick a forum to add the thread to
$forum_id = 82;
$title = "Testing 1-2-3";
$post_text = "Blah Blah Blah Blah";
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$foruminfo = fetch_foruminfo($forum_id);
$threaddm->set_info('forum', $foruminfo);
$threaddm->set('forumid', $foruminfo['forumid']);
$threaddm->set('userid', $userid);
$threaddm->set('title', $title);
$threaddm->set('pagetext', $post_text);
$threaddm->set('allowsmilie', 1);
$threaddm->set('visible', 1);
$threaddm->pre_save();

if (count($threaddm->errors) > 0)
{
    // Errors occurred. Do not proceed with the save.
    // You may want to loop through $dataman->errors and 
    // display the results the user.
    $errorlist = '';
    foreach ($threaddm->errors AS $index => $error)
    {
        $errorlist .= "<li>$error</li>";
    } 
    echo "<ul>" . $errorlist . "</ul>";
}
else
{
    // No errors occurred.
    // Proceed with the save (see the next step).
    $thread_id = $threaddm->save();
    build_forum_counters($forum_id);
    echo "<br />thread id: " . $thread_id . "\n";

}  
/* --- Insert calendar item into vBulletin forums --- */

?>

</body>
</html>
When I insert this code into my calendar php script, the following fatal error is recorded in the php error log, 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

I have ensured that the call to vBulletin's global.php is not inside a function. Here is some of the code from my calendar script ...

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_pass, true) 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>
[ ... ]
</head>
<body>
[ ... calendar html and php ...]

[ ... vBulletin test code as per above ... ]

[ ... calendar html and php ...]

</body>
</html>
Can anyone point me to where I can further analyse and resolve this? Or perhaps even can see my problem? Thanks.
Reply With Quote
 


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 07:24 PM.


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.05505 seconds
  • Memory Usage 2,385KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • 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_threaded
  • showthread_threaded_construct_link
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete