Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Create Posts
fly
Join Date: Oct 2003
Posts: 1,215

 

Show Printable Version Email this Page Subscription
fly fly is offline 12-06-2005, 10:00 PM

PHP Code:
require_once('./global.php');
require_once(
'./includes/class_dm.php');
require_once(
'./includes/class_dm_threadpost.php');

$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD);

$postthreadid '4473';
$postusername 'admin';
// Use $postusername if posting as a guest, use $postuserid if posting as a user
//$postuserid = '1';
$postpagetext 'Hi mom!';

$threadinfo fetch_threadinfo($postthreadid);
$foruminfo fetch_foruminfo($threadinfo['forumid']);

$postdm->set_info('forum'$foruminfo);
$postdm->set_info('thread'$threadinfo);  
$postdm->set('threadid'$postthreadid);
$postdm->set('username'$postusername);
// Use $postusername if posting as a guest, use $postuserid if posting as a user
//$postdm->set('userid', $postuserid);
$postdm->set('pagetext'$postpagetext);
$postdm->set('allowsmilie'1);
$postdm->set('visible'1);
$postdm->set('dateline'TIMENOW);
$postdm->save();
unset(
$postdm); 
Reply With Quote
  #42  
Old 10-23-2007, 03:43 PM
Thibaut Thibaut is offline
 
Join Date: Oct 2007
Location: Toulouse, France
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I get the id of the thread ?
Thanks
Reply With Quote
  #43  
Old 10-24-2007, 06:23 AM
zytzagoo zytzagoo is offline
 
Join Date: Sep 2007
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Thibaut View Post
How can I get the id of the thread ?
Thanks
PHP Code:
$thread_id $threaddm->save(); 
Reply With Quote
  #44  
Old 10-24-2007, 07:08 AM
Thibaut Thibaut is offline
 
Join Date: Oct 2007
Location: Toulouse, France
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks !
Reply With Quote
  #45  
Old 11-21-2007, 09:01 AM
Tinh.Nhi Tinh.Nhi is offline
 
Join Date: Jan 2003
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how to use the code like thank please ?
Reply With Quote
  #46  
Old 12-21-2007, 02:42 PM
paolo.capitani paolo.capitani is offline
 
Join Date: Sep 2007
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for the thread!
how can I add a break line in the content of the just added post?
Reply With Quote
  #47  
Old 12-24-2007, 04:57 PM
TCooper TCooper is offline
 
Join Date: Mar 2004
Location: Virginia Beach, VA
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was able to make a script that posts a new thread to a user defined forum but not able to make it post a reply to a current thread. I tried using the example in the first post and it didnt work, can someone please help with a new post to current thread.
Reply With Quote
  #48  
Old 12-24-2007, 05:32 PM
amcd amcd is offline
 
Join Date: Oct 2004
Posts: 218
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD); 

$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);
$postdm->save();
unset(
$postdm); 
this works.
Reply With Quote
  #49  
Old 04-12-2008, 01:43 PM
sonata sonata is offline
 
Join Date: Jul 2005
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ruinernix View Post
This works, but all messages created end up in a moderation queue even though the forum is not set to moderate posts/threads. I tried adding 'visible'=>'1' but it doesn't make a difference. Any clues? I suppose it's because I'm running this from an outside script, that isn't really logged into VB. I made a modification to functions_newpost.php
PHP Code:
Replaced:
    
// see if post has to be moderated or if poster in a mod
    
if ( 
        ((
With:
    
// see if post has to be moderated or if poster in a mod
    
if ( ($post['visible'] == 0) AND
        (( 
It does the job, but I'd like to understand why it's not working properly..
Any solution for this? I still encounter this problem when I use build_new_post function. Right now, I have to execute SQL queries to delete it from moderation table and set the visible flag to one. Any better solution?
Reply With Quote
  #50  
Old 04-12-2008, 01:58 PM
amcd amcd is offline
 
Join Date: Oct 2004
Posts: 218
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

build_new_post assumes that you are adding a post for the same user who is logged in. use the data manager.
Reply With Quote
  #51  
Old 05-23-2008, 02:53 PM
silly rabbit silly rabbit is offline
 
Join Date: Oct 2005
Location: Atlanta/NYC
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by flypaper View Post
Then you'd find the thread about HowTo Create Threads.
Cute! flypaper, a somewhat related question to the topic at hand, creating posts . . .

. . . if editing an existing post I'd like to have a simple "check box" in the editor that would flag/include the updated post into the "New Posts" search engine for everyone to review, see. Ever seen such a hack before? Easily possible?

Great Thread, thx Rabbit
Reply With Quote
Reply


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 04:22 PM.


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.06689 seconds
  • Memory Usage 2,340KB
  • Queries Executed 26 (?)
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
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (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_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete