vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to attach files with new thread (using data manager) ? (https://vborg.vbsupport.ru/showthread.php?t=215268)

ULFSoft 06-03-2009 03:00 PM

How to attach files with new thread (using data manager) ?
 
How can i attach files 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!)

Dismounted 06-04-2009 04:46 AM

Have you tried looking at how vBulletin does it? Look at the forms, then looks at the processing behind them.

ULFSoft 06-04-2009 08:07 PM

Quote:

Originally Posted by Dismounted (Post 1823160)
Have you tried looking at how vBulletin does it? Look at the forms, then looks at the processing behind them.

Yes,
when we want to create a new thread, there is a variable named posthash that in the processing point to the first post of thread!
but when we use data manager, posthash doesn't exist!
(sorry for my bad grammer!)

Dismounted 06-05-2009 04:26 AM

When you call the "save" method of the Post DM, you will receive that post's ID.

ULFSoft 06-05-2009 07:44 AM

Quote:

Originally Posted by Dismounted (Post 1823756)
When you call the "save" method of the Post DM, you will receive that post's ID.

PHP Code:

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

$threaddm =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAY'threadpost');
$forumid 12
$title $charNames $txtttl $charClass;
$pagetext $txtbody;
$foruminfo fetch_foruminfo($forumid);
$threaddm->set_info('forum'$foruminfo);

$forum_id = (int)$forum_id;
$pagetext = (string)strip_tags($pagetext);
$title = (string)strip_tags($title);
                
$threaddm->set('forumid'$foruminfo['forumid']);
$threaddm->set('userid'1096);
$threaddm->set('title'$title);
$threaddm->set('pagetext'$pagetext);
$threaddm->set('allowsmilie'1);
$threaddm->set('visible'1);
$threaddm->set('dateline'TIMENOW);

$threaddm->pre_save();
if (
count($threaddm->errors) > 0) {
    
print_r($threaddm->errors);
}
else {
    
$threaddm->save(); 
    
build_forum_counters($forum_id);


I used above code to create new thread.
Did you mean attach files after posting thread?!
But if i want to make links to attached files in the thread, i need to attach files before posting thread, or edit thread after attaching files !!!

Andreas 06-05-2009 04:03 PM

Create a posthash, create attachments for the posthash, pass the hash to the threadfp dm - just like vBulletin does it :)

ULFSoft 06-05-2009 04:26 PM

Quote:

Originally Posted by Andreas (Post 1824036)
Create a posthash, create attachments for the posthash, pass the hash to the threadfp dm - just like vBulletin does it :)

thank you :-*,
I will try this.

ULFSoft 06-08-2009 02:10 AM

Quote:

pass the hash to the threadfp dm
Can you explain deeper? (how?)

Andreas 06-09-2009 07:12 AM

Take a look at build_new_post() in includes/functions_newpost.php, read and learn how vBulletin does stuff :-)

PHP Code:

$dataman->set_info('posthash'$post['posthash']); 



All times are GMT. The time now is 06:16 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.02863 seconds
  • Memory Usage 1,742KB
  • 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
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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