vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using Data Manager to create thread from outside vBulletin (https://vborg.vbsupport.ru/showthread.php?t=224110)

mouth 09-28-2009 01:41 PM

Using Data Manager to create thread from outside vBulletin
 
Hi,

New vBulletin user, having just converted from phpBB with ~15,000 users and ~1million posts. Impex worked great :) No mods (yet), just 3.8.4 out of the box. I'm good with PHP, but not enough to get my head around the data managers :o

I've read the official docs for the data mangers, read and searched through this site, and even googled and found a few examples. Spent several hours trying to get my data managers usage working, but after still failing I thought I'd ask my first post on here.

My site has an external (to vBulletin) event calendar that users can add events too (after moderation). A thread/topic was then created in phpBB for that new calendar entry with some initial text and a link back to the calendar entry details. I am trying to replicate this functionality through to vBulletin.

Is there a full and working example code available for using the data managers from outside vBulletin to create a new thread in vBulletin? I think my issue in getting this working is a combination of lacking information in the officials doc's teamed with outdated/wrong examples found in here and via google.

For your giggles, here's the code I'm currently have (after many iterations and changes) but which I still can't get to create a new thread ....

PHP Code:

<?php

$forums_path 
$_SERVER['DOCUMENT_ROOT'] . '/forums';
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');

$threaddm = new vB_DataManager_Thread_FirstPost($vbulletinERRTYPE_STANDARD);
$post_userid 1// Admin
$userid 1;
$user_name 'Admin';
$allow_smilie '1';
$visible '1';

$forum_id 65;
$title strip_tags("Testing 1-2-3");
$post_text strip_tags("abc 123");

$threaddm->do_set('forumid'$forum_id);
$threaddm->do_set('postuserid'$post_userid);
$threaddm->do_set('userid'$userid);
$threaddm->do_set('username'$user_name);
$threaddm->do_set('posttext'$post_text);
$threaddm->do_set('title'$title);
$threaddm->do_set('allowsmilie'$allow_smilie);
$threaddm->do_set('visible'$visible);
$threaddm->save();

build_forum_counters($forum_id);

?>

When I run the above, I get a standard forums (template) page with a message of "A required field called pagetext is missing or has an invalid value."


Thanks.

Lynne 09-28-2009 02:27 PM

This article should help you out - Create Posts


All times are GMT. The time now is 12:59 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.01084 seconds
  • Memory Usage 1,726KB
  • 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)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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