1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Importing New Threads

Discussion in 'XenForo Development Discussions' started by latimer, Mar 18, 2011.

  1. latimer

    latimer Active Member

    I have a number of discussions from the admin section of my site that I'd like to import into XenForo. Is it as easy as creating a an entry for each thread in xf_thread, inserting the posts into xf_post then remapping the user_id + node_id to their appropriate values then rebuilding the search/thread/forum information in the admin panel? Or is there more to it that I need to take into account?
  2. Mike

    Mike XenForo Developer Staff Member

    More or less. You can look at how the importer handles it, or how threads/posts are created in the thread and forum controllers.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Manually inserting data into a database is generally not recommended due to dependencies and relationships with other tables and fields.

    I haven't studied the DB in detail but there is more to it than that; the xf_forum table would need updating for one, and the xf_user table.
  4. ragtek

    ragtek Guest

    Not really!
    If you use the datawriter, xenforo handles all the stuff;)
    class Ragtek_Helper_DataWriter
         * Helper for XenForo Thread Datawriter to create a thread
         * @param array $user
         * @param <int> $forumId
         * @param <str> $subject
         * @param <str> $message
         * @return <array> Thread Information
    static public function createThread($user$forumId$subject$message)
    $writer XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
    $postWriter $writer->getFirstMessageDw();
  5. Brogan

    Brogan XenForo Moderator Staff Member

    As I understood the thread author, he wasn't going to use the datawriter and just enter the queries manually.
  6. ragtek

    ragtek Guest

    That's why i (tried to)say, that he should use the datawriter instead of the query.

Share This Page