View Full Version : How to move thread to another forum via API?
DannyvdK
08-25-2011, 12:25 PM
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.
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.
DannyvdK
08-26-2011, 07:51 AM
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?
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.
DannyvdK
08-29-2011, 05:56 AM
Thank you very much kh99. I'll start crackin' DIY style. ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.