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 create new threads with attachments automatically through a script (https://vborg.vbsupport.ru/showthread.php?t=209317)

rammbs 03-24-2009 05:04 PM

How to create new threads with attachments automatically through a script
 
Hi,

I just want to create new threads with attachments through a script on a daily basis.

This should act as an interface to vbulletin forum to post new threads.

The script can be in perl or php or anything.

Can any body please help me how i should start and go forward in this?

Thanks,
Raja

Dismounted 03-25-2009 08:46 AM

You can do all those with the appropriate data managers. See documentation for this in the manual: vBulletin Data Managers.

rammbs 04-07-2009 06:55 AM

Hi Hanson,

I could able to create a new thread with out an attachment. But i tried a lot to create with an attachment, and i failed to do so.

Can you please help me in this regard?

From the data managers manual, i understood that, i could use "Threads with a Post" data manager to post a thread with an attachment, but i really dont understand how?

+Raja

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

Hi Hanson,

Which one solves my problem in this?

should i use "Threads with a Post" or "posts" or "Attachments" data manager?

could you explain, what parameter i need to set for this datamanager?

+Raja

Dismounted 04-07-2009 08:00 AM

To create a thread and add an attachment - you need to use both. Parameters that are to be set can be found in the $valid_fields[] array in the class of each data manager.

rammbs 04-07-2009 10:57 AM

You mean, i have to do the following:

$attachdata =& datamanager_init('Attachment', $vbulletin, ERRTYPE_ARRAY);
foreach ($attachdata->$valid_fields AS $key => $value){

echo " KEY : $key => VALUE : $value";

}

to know the keys of the array and existing values.

+Raja

rammbs 04-08-2009 05:07 AM

1 Attachment(s)
When i printed the value for

*************
$attachdata =& datamanager_init('Attachment', $vbulletin, ERRTYPE_ARRAY);
print_r($attachdata->validfields);

*****************
i got the information which is not in useable format.

For your reference, i am attaching the output for the following statement.

$attachdata->validfields

Please guide me , how i could use this information to post an attachment.

+Raja

Dismounted 04-08-2009 06:17 AM

Open the actual class file and look inside it...

rammbs 04-08-2009 05:17 PM

How can we pass contents of the file to 'filedata'?
Can this be allowed? if so, can i read all the data from a file into a variable($data) and pass that variable to $attach->set('filedata',$data) function.

+Raja

Dismounted 04-09-2009 04:17 AM

That's exactly what you do.

rammbs 04-09-2009 04:19 AM

Okay , i got this, i could able to set the filedata in this way.

By the way,

Can i create a thread with an attachment with out creating two data managers, one for 'Thread' and another for 'Attachment' ?

If i must use two datamanagers, how would i link attachment to the thread?

Can i use postid to link both thread and attachment? or is there any otherway around?

if i have to use postid to link thread and attachment, how would i get postid from the newly created thread?

+Raja


All times are GMT. The time now is 03:20 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.01191 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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