Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2009, 08:29 AM
Labelsoft Labelsoft is offline
 
Join Date: Mar 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding threads via .NET application

Hello,

Does anyone on this board have experience with programmatically adding threads (and ofcourse their first post) in vBulletin's forum via a .NET application?

I have looked at the API's (in PHP) which vBulletin made available and it seems that I would need: "class_dm_threadpost.php", if I would be programming in PHP. The problem now is that I need to insert threads via a .NET application I'm developing.

I've scrolled through this API and it's 36 pages long, which indicates to me that inserting a thread is not as easy as it would seem. Namely inserting a record in the 'thread' table and a record in the 'post' table and voila. Or is it this simple?

Is there anyone that can point me into the right direction? Thank you very much in advance for answering.
Reply With Quote
  #2  
Old 07-09-2009, 09:42 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is mainly SQL queries, to add the thread, the post, and update some caches. It is not as "simple" as some people think.

What I suggest is maybe creating your own PHP file that when called upon, creates a thread. This would allow you to use vBulletin classes/methods, and thus, reducing the chance of things breaking in the future.
Reply With Quote
  #3  
Old 07-09-2009, 11:54 AM
Labelsoft Labelsoft is offline
 
Join Date: Mar 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First off, thank you very much for replying so soon.

I am a complete PHP novice, so in order to fully understand what you mean, can I ask some more questions?

1) What do you exactly mean with making my own PHP file? I'm sure with some time I could create some PHP script (with some help from you *looks hopefull* ) that would make using vBulletin's classes/methods easier. But if I have that file, what do I do with it? I don't know of a way to call such a PHP file from .NET code.

2) I'm afraid I'll have to do it the hard way. I'll have to add a thread + post + update some caches manually from .NET code. If I go that way, could you help me a bit? For example... What are those caches you are talking about? And which ones need an update?

By the way... Just to make my intentions absolutely clear. My .NET app's soul purpose is to just shoot a thread (+ post) into vBulletin's MySQL DB. After that, the app is basically done. It doens't need to know anything about it, or manage it further. Would perhaps make the process a bit simpler?

Thnx in advance for your help!
Reply With Quote
  #4  
Old 07-09-2009, 12:12 PM
GameDude GameDude is offline
 
Join Date: Jan 2006
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure able .NET, but I posted a PHP class a couple of days ago to make threads, posts, and send PMs. It has all the proper SQL queries in it. Here is the link to the thread.
Reply With Quote
  #5  
Old 07-10-2009, 08:52 AM
Labelsoft Labelsoft is offline
 
Join Date: Mar 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much GameDude. I've scanned the code and I certainly think it'll help me construct .NET code which will do the same as your PHP class. Just two quick questions though:

1) vBulletin's DB doesn't auto increment the technical ID's (I see you adding 1 to the id's in the code)?

2) You don't need the column 'DateLine' (you insert post and thread without dateline)?

Thnx again for the code and thnx in advance for answering.
Reply With Quote
  #6  
Old 07-10-2009, 09:48 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Labelsoft View Post
vBulletin's DB doesn't auto increment the technical ID's (I see you adding 1 to the id's in the code)?
The primary keys in all tables with one defined are auto incremented, and a value should NEVER be inserted by hand. MySQL does the work.
Quote:
Originally Posted by Labelsoft View Post
You don't need the column 'DateLine' (you insert post and thread without dateline)?
The dateline must be generated and inserted, it is not automatically inserted by MySQL.
Reply With Quote
  #7  
Old 07-10-2009, 10:01 AM
Labelsoft Labelsoft is offline
 
Join Date: Mar 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Dismounted:

1) Yeah, I figured that would be a bit strange. But have you seen Gamedude's code? He claims it works. If this is true, his code could never work.

2) Ok, how does one generate a Dateline then? What is it exactly? It looks a bit like an UNIX timestamp.

3) Last question, could you please take a quick peek at Gamedude's code and tell me if that code works? 'Cause then I'm going to stop immediatly converting his PHP code to .NET code.

Thank you in advance.
Reply With Quote
  #8  
Old 07-10-2009, 11:18 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Labelsoft View Post
Yeah, I figured that would be a bit strange. But have you seen Gamedude's code? He claims it works. If this is true, his code could never work.
MySQL doesn't stop you from entering arbitrary values, his code will probably cause issues down the track though (e.g. duplicate IDs, etc.).
Quote:
Originally Posted by Labelsoft View Post
Ok, how does one generate a Dateline then? What is it exactly? It looks a bit like an UNIX timestamp.
It is exactly what you guessed - a simple Unix timestamp.
Quote:
Originally Posted by Labelsoft View Post
Last question, could you please take a quick peek at Gamedude's code and tell me if that code works? 'Cause then I'm going to stop immediatly converting his PHP code to .NET code.
The code probably works, but is it the best method? Probably not. See the function "build_new_post()", it contains what you want - the "method" of generating a post/thread.
Reply With Quote
  #9  
Old 07-10-2009, 12:57 PM
Labelsoft Labelsoft is offline
 
Join Date: Mar 2009
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Dismounted

Ok, I've found a way to call PHP "method". It envolves wrapping PHP with WSDL (NuSOAP makes this easy) and referencing it as a service in Visual Studio. I found this information here: http://www.phpeveryday.com/articles/...rt-2--P68.html

Can you tell me where I can find the "build_new_post()" function?

I will post my progress here, so in the future you can reference people to this topic if they have a similar problem.

p.s.: I suppose you guys haven't already wrapped PHP files with WSDL? *looks hopefull*
Reply With Quote
  #10  
Old 07-10-2009, 12:59 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Labelsoft View Post
Can you tell me where I can find the "build_new_post()" function?
/includes/functions_newpost.php

Also see newthread.php or newpost.php for an implementation example.
Reply With Quote
Reply

Thread Tools
Display Modes

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 10:51 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.10699 seconds
  • Memory Usage 2,248KB
  • Queries Executed 13 (?)
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
  • (6)bbcode_quote
  • (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
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete