Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2009, 05:04 PM
rammbs rammbs is offline
 
Join Date: May 2005
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 03-25-2009, 08:46 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can do all those with the appropriate data managers. See documentation for this in the manual: vBulletin Data Managers.
Reply With Quote
  #3  
Old 04-07-2009, 06:55 AM
rammbs rammbs is offline
 
Join Date: May 2005
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 04-07-2009, 08:00 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 04-07-2009, 10:57 AM
rammbs rammbs is offline
 
Join Date: May 2005
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 04-08-2009, 05:07 AM
rammbs rammbs is offline
 
Join Date: May 2005
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Attached Files
File Type: txt attacheddata_validfieds.txt (4.1 KB, 14 views)
Reply With Quote
  #7  
Old 04-08-2009, 06:17 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Open the actual class file and look inside it...
Reply With Quote
  #8  
Old 04-08-2009, 05:17 PM
rammbs rammbs is offline
 
Join Date: May 2005
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 04-09-2009, 04:17 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's exactly what you do.
Reply With Quote
  #10  
Old 04-09-2009, 04:19 AM
rammbs rammbs is offline
 
Join Date: May 2005
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 02:33 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.07631 seconds
  • Memory Usage 2,273KB
  • Queries Executed 14 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete