The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Copy Thread to Second Forum Using newthread_post_complete Plugin
Hello,
As the title suggests, I am trying to figure out the PHP code needed to create a plugin that generates a second, exact copy of a thread but in a specific forum using a hooked plugin for newthread_post_complete. I've searched far and wide and the closest information I've found is a a few years old in this thread, but more importantly seems to be for a situation where the code is specifying a lot of the information manually (such as 'pagetext', 'userid', etc.) The closest I've come to a solution is the following snippet of code which unfortunately instead of creating a copy of the thread, actually seems to just move the existing thread into the new forum: PHP Code:
If anyone has any insight into the code I might need to accomplish this I would truly appreciate any and all assistance. Thanks! |
#2
|
|||
|
|||
Yeah, I think what I'd do is start again with a new data manager and set the fields just like it does when a new one is being created (in build_new_post(), IIRC), but set the forumid to the other forum. But even that might not work completely right because I think some of the fields in the post array get changed because they are references. But I don't remember the details offhand.
|
#3
|
|||
|
|||
Except for closed threads, thread copying is not very useful to the average user, due to how the thread tables were designed (there is no direct mechanism to keep the threads synced since they will have different ID's in the thread table).
We added an additional table to keep track of linked threads, and created handlers for post updating and for the additional caching. Much of this was done in extending the classes in the threadpost datamanager. Anyway, it was a big project and certainly was not worth the time and effort we put into it. So if you are not working on closed threads, re-think what you are doing. |
#4
|
|||
|
|||
Quote:
Instead, I simply want to perform a copy of the first post of a thread after a certain action (that action is irrelevant to this discussion) through the Plugin, and with that first post make a new thread with the same content as the original post but in another forum. Each of the two threads would then be normal threads with unique IDs, child posts, counters, all that stuff. Put another way: I am trying to find the easiest method via the plugin hook to extract the basic information about the newly created post and then with that information in hand, create a second post (and thus thread) in a different forum. The only important data that needs to be copied from my perspective is: Post Subject Post Content Author/Username Timestamp From my research I believe using the DataManager is the best route for this, but if that's not the case or anyone has any information or code snippets that would help, I'd really appreciate it! Thanks! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|