vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Create Posts (https://vborg.vbsupport.ru/showthread.php?t=102418)

vrinteractive 09-19-2008 10:39 PM

is there a setting i need to configure in admincp? I'm trying to add a forum thread useing the datamanger_init, and save is returning a new id, but when i try to visit the thread i get a permissions error. it's on 3.7.2

fly 09-19-2008 11:28 PM

Quote:

Originally Posted by vrinteractive (Post 1625938)
is there a setting i need to configure in admincp? I'm trying to add a forum thread useing the datamanger_init, and save is returning a new id, but when i try to visit the thread i get a permissions error. it's on 3.7.2

I think there is another thread on how to create threads. It may be more ontopic there. Otherwise, I think we'd need to see your code...

LoRdGd 09-20-2008 11:53 AM

Read my topic on vbulletin.com:
http://www.vbulletin.com/forum/showt...23#post1578823

Mutt 05-03-2009 04:07 PM

Quote:

Originally Posted by ragtek (Post 1365393)
with this code:
PHP Code:

$threaddm =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAY'threadpost');

$forumid $vbulletin->GPC['fid']; // can also be a number ;) $forumdid= 12;

$foruminfo fetch_foruminfo($forumid);
$threaddm->set_info('forum'$foruminfo);

$threaddm->set('forumid'$foruminfo['forumid']);
$threaddm->set('userid'1234);
$threaddm->set('title''Testtitle');
$threaddm->set('pagetext''a little test');
$threaddm->set('allowsmilie'1);
$threaddm->set('visible'1);
$threaddm->set('dateline'TIMENOW);
$threaddm->save(); 

if you need the threadid save it with
PHP Code:

$id $threaddm->save(); 



this works but how can I also set the prefix? added a prefix line returns an error

--------------- Added [DATE]1241372989[/DATE] at [TIME]1241372989[/TIME] ---------------

found it. you have to use "prefixid" & you set it to the prefix var. like this

$threaddm->set('prefixid', 'report');

I'm using this for our mod forum so alerted posts or pms have prefixes

ULFSoft 06-02-2009 08:41 PM

how can i attach file when i want to create a thread with data manager?
i think that i must use class_dm_attachment.php but how?
can anyone help me?
(i am new to vb programming!)

todd73nj 09-01-2009 01:07 AM

I was wondering if someone could tell me what is wrong with my script. All I am trying to do is post a new message in an existing thread. When I put this script in a php page and hit it from my browser, I don't get any error, but I also don't get a message posted. I don't even see the "save returned" message in my browser. If I change some things (like the path to class_dm_threadpost), I get an error, so I know it is running something.

As for the echo not working, it seems like as soon as I put those require_once at the top of my file, I can't echo any messages anymore. But I only have those echos in there because the message isn't being posted to my thread.

PHP Code:

<?php
require_once('global.php'); 
require_once(
'./includes/class_dm_threadpost.php');

$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD); 

$threadid=1565;
$forumid=5;
$symid='asdf';
$userid=2;
$message="Testing.Testing.Testing.Testing.Testing.";

$timenow TIMENOW;
$threadinfo fetch_threadinfo($threadid);
$foruminfo fetch_foruminfo($forumid);

$postdm->set_info('forum'$foruminfo);
$postdm->set_info('thread'$threadinfo);  
$postdm->set('threadid'$threadid);
$postdm->set('title'$symid);
$postdm->set('userid'$userid);
$postdm->set('pagetext'$message);
$postdm->set('allowsmilie'1);
$postdm->set('visible'1);
$postdm->set('dateline'$timenow);
$xxx $postdm->save();
unset(
$postdm);  
echo 
"save returned:";
echo 
$xxx;

?>


amcd 09-01-2009 07:28 AM

Do you have access to php.ini and/or PHP error log? Check the error log.

If echo does not work, try the PHP error_log() function. You may also find the var_export() function useful.

I have almost the same code working with vb 3.6.1. What is your version?

todd73nj 09-01-2009 01:12 PM

I am running 3.7.4 PL1.

If I start with an empty php file and just put an echo statement, I see the message when I hit the page. Anything I echo before the line that includes class_dm_threadpost.php I see output, but anything after I don't. For example:

PHP Code:

<?php
require_once('global.php'); 
require_once(
'./includes/class_dm_threadpost.php');

echo 
"Hello world.";
?>

Shows nothing in the page. But
PHP Code:

<?php
require_once('global.php'); 
echo 
"Hello world.";
require_once(
'./includes/class_dm_threadpost.php');

?>

Shows "Hello world." on the page.

I am using godaddy, so I don't know how I can access the php error file. I tried using an set_error_handler as described on this page: http://us3.php.net/set-error-handler , to catch any errors, but still I got no output. It is bizarre. It is like including that class_dm_threadpost is killing everything. I have not modified any of my vbulletin files, so it should be whatever came with 3.7.4.

var_export() behaves the same way as echo. Before that require_once line it works, after it, I see nothing.

--------------- Added [DATE]1251815891[/DATE] at [TIME]1251815891[/TIME] ---------------

Doh. I figured it out. I have to include another file as well (class_dm.php). It seems like without it, something in the class_dm_threadpost was unhappy.

This works:

PHP Code:

<?php
require_once('global.php'); 
require_once(
'./includes/class_dm.php'); 
require_once(
'./includes/class_dm_threadpost.php');

$threadid=1565;
$forumid=5;
$symid='asdf';
$userid=2;
$message="Testing.Testing.Testing.Testing.Testing.";

$timenow TIMENOW;
$threadinfo fetch_threadinfo($threadid);
$foruminfo fetch_foruminfo($forumid);

$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD); 
$postdm->set_info('forum'$foruminfo);
$postdm->set_info('thread'$threadinfo);  
$postdm->set('threadid'$threadid);
$postdm->set('title'$symid);
$postdm->set('userid'$userid);
$postdm->set('pagetext'$message);
$postdm->set('allowsmilie'1);
$postdm->set('visible'1);
$postdm->set('dateline'$timenow);
$xxx $postdm->save();
unset(
$postdm);  
echo 
'save returned:';
echo 
$xxx;
?>


ewelin 10-07-2009 07:12 PM

Quote:

Originally Posted by Evercraft (Post 960421)
You need to add the following code, after the post has been created, to update forum counters and last post index etc.

PHP Code:

require_once(DIR '/includes/functions_databuild.php');
build_forum_counters($threadinfo['forumid']); 


I have a slight problem.... My code is inserting the post perfectly and everything is working in that respect. The problem is that the last post field is not being updated. I know this has something to do with the timestamp, but I'm not sure why the issue is happening. I'm importing a chat transcript and putting each chat post as a forum post. The import script runs every 5 minutes and uses the chat post's timestamp as the forum post time stamp. The forum posts appear just as they were posted within the chat and the time is dead on... Even with the above code included at the end, it only updates the forum counters, it doesn't update the last post index. Now if I swap the timestamp from the actual chat post time to TIMENOW
it's updated. Anyone have any ideas on how I can resolve this.

amcd 10-08-2009 08:50 AM

Did you try build_thread_counters?


All times are GMT. The time now is 10:46 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04257 seconds
  • Memory Usage 1,787KB
  • 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
  • (7)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete