View Full Version : How to create new threads with attachments automatically through a script
rammbs
03-24-2009, 05:04 PM
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 (http://www.vbulletin.com/docs/html/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 1239091478 at 1239091478 ---------------
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
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
Dismounted
04-09-2009, 06:45 AM
You create your thread, then add the attachment... The data managers return the insert ID when saving.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.