Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 08-25-2011, 12:25 PM
DannyvdK DannyvdK is offline
 
Join Date: Aug 2011
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to move thread to another forum via API?

Dear vBulletin experts,

I would like to programmatically move a thread from one forum to a different forum by using vBulletin's API. That's all basically.

I am a VB.NET programmer, so I'll have to use WSDL proxy to be able to call PHP functions, I'm aware of this.

However I am lost in the API jungle. Could someone point me to the right direction? Which class? Which function? Does anyone else have experience with .NET and vBulletin API?

Thanks in advance for answering.
Reply With Quote
  #2  
Old 08-25-2011, 02:00 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I usually figure these things out by finding where it's done in the code. In this case I looked in inlinemod.php at the section that starts with "if ($_POST['do'] == 'domovethreads')", around line 2119. It looks like it basically just updates the forumid field in the thread table, but it also does a lot of permission checks and validation before, and some clean-up tasks after.
Reply With Quote
  #3  
Old 08-26-2011, 07:51 AM
DannyvdK DannyvdK is offline
 
Join Date: Aug 2011
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First off, thnx for replying kh99.

Yeah, I learned the hard way that a forum record holds alot of stuff like postcount, lastpostid, etc...

So that made me realize that it wasn't simply a matter of changing forumid in a thread record. I could ofcourse fire off all the necessary queries to clean up the forum record, but I thought what else should be cleaned up?

I'm not a PHP programmer, so I think it's difficult for me to find in all that code exactly what I need.

There isn't a function that I can call to move the thread for me?
Reply With Quote
  #4  
Old 08-26-2011, 02:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DannyvdK View Post
There isn't a function that I can call to move the thread for me?
Not that I know of, but I took the code from inlinemod.php and made a function out of it. I did a little testing, but it's definitely 'use at your own risk' (see attached).

BTW, the way it is now, if the 'destforumid' passed to the function is invalid, it will redirect you to an error page (which is most likely not what you want). I took out all the other redirects, but that one's in another function that gets called by this one. SHouldn't be a problem if you're passing a valid forumid.
Attached Files
File Type: zip movethreads.zip (3.3 KB, 32 views)
Reply With Quote
  #5  
Old 08-29-2011, 05:56 AM
DannyvdK DannyvdK is offline
 
Join Date: Aug 2011
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much kh99. I'll start crackin' DIY style.
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 03:37 AM.


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.03892 seconds
  • Memory Usage 2,206KB
  • Queries Executed 12 (?)
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)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (1)postbit_attachment
  • (5)postbit_onlinestatus
  • (5)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete