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

XF 1.1 Importing Wordpress into Xenforo

Discussion in 'XenForo Questions and Support' started by akia, Jan 13, 2012.

  1. akia

    akia Well-Known Member

    Has anyone got any ideas of how best to import my wordpress site into Xenforo.

    I just want my posts to go into my forum as threads.

    I've tried using Vb impex as a go between but not having any luck with that as its not been updated to the new wordpress.

    So now I'm stuck, and I don't want to have to do a copy and paste job. So any suggestions welcome!
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    In the absense of a direct importer for wordpress I would suggest vB. Assuming the schema changes aren't significant, it shouldn't be too difficult to update the existing wordpress system in impex to accommodate your version.

    How big is your wordpress database? If you give me a copy then I can try to make it work.
     
  3. akia

    akia Well-Known Member

    Its 19mb about 1200 articles.

    If you don't mind that would be amazing, i've been going round in circles for days.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That's tiny. Send me a link where I can download a backup and I'll see what I can do with it.
     
  5. Van Damm

    Van Damm Member

    Hi! I've stumbled into the same problem lately. Could you please share any result's you've got on converting wordpress posts to XenForo threads?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There were a couple bugs in the ImpEx Wordpress system I had to fix, and it was still quirky and required some manual queries after the import was done. But I got it working. I can look at your import if you give me a copy of your database.
     
  7. Lucas

    Lucas Well-Known Member

    Is it possible to import articles into a specified forum and the comments retain their names but be shown as Guests?
     
  8. Hugo Santos

    Hugo Santos Active Member

    I realy like to import my database too :D
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That's what I do when I import from Wordpress. I run some queries to convert the articles to forum threads. Yes, it is possible to run a query to remove the user associations on those threads so they are posted by guests while still retaining the usernames. I can do this for you if you give me a copy of your WP database.

    I seem to remember that the importer brought over articles without any comments attached. Or maybe the source db simply had no comments in the articles. It's something to be aware of... that the importer might not do comments.

    Same for you. I can do the import if you give me a copy of your WP database.
     
  10. Hugo Santos

    Hugo Santos Active Member

    Many thanks Jake, i'll send you my database (y)
     
  11. Lucas

    Lucas Well-Known Member

    Sent! Thank you very much.
     
  12. steven s

    steven s Well-Known Member

    I too would like to import some wordpress posts to xf.
    So far I have 135 from an RSS feed.
    What would I need to do if I use impex first?
     
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The Wordpress system in ImpEx has a lot of problems. It doesn't import comments to articles so you have to do that manually. And the system fails to create the importid columns in the database so you have to do that manually. Given these problems it might almost be easier to write a new direct importer to go from WP to XF. I just like using vB because I know it so well.

    From my notes, to import users and articles (as threads) from Wordpress this is the process:

    1) Install vB4 and ImpEx.

    2) Select the WPCMS for the source system and the vB4 CMS for the target.

    3) Run the first module (check / update tables). If that completes successfully then run these queries to create the importid columns which ImpEx fails to create:

    Code:
    ALTER TABLE cms_article ADD importcmscontentid INT UNSIGNED NOT NULL DEFAULT '0';
    
    ALTER TABLE cms_node ADD importcmsnodeid INT UNSIGNED NOT NULL DEFAULT '0';
    
    ALTER TABLE cms_nodeinfo ADD importid INT UNSIGNED NOT NULL DEFAULT '0';
    
    4) Run the user module to import the users. Don't bother with the article module as it doesn't do the comments, and has some strange batch processing issues. You will import the articles manually.

    5) Close out the import by clicking the "database cleanup" link at the top. Select the option to delete the session to close it out.

    6) Copy these two tables from the Wordpress database to the vB database:

    wp_posts
    wp_comments


    7) Run these queries to manually import the articles/comments as threads/posts:

    Code:
    INSERT INTO thread (threadid, title, forumid, open, postuserid, dateline, visible)
    	SELECT ID, post_title, 2, 1, (SELECT userid FROM user WHERE importuserid = wp_posts.post_author AND wp_posts.post_author > 0), UNIX_TIMESTAMP(post_date), 1
    	FROM wp_posts
    	WHERE post_type = 'post';
    
    INSERT INTO post (postid, threadid, username, userid, dateline, pagetext, visible)
    	SELECT comment_ID, comment_post_ID, comment_author, (SELECT userid FROM user WHERE importuserid = wp_comments.user_id AND wp_comments.user_id > 0), UNIX_TIMESTAMP(comment_date), comment_content, 1
    	FROM wp_comments;
    
    INSERT INTO post (threadid, username, userid, dateline, pagetext, visible)
    	SELECT ID, '', (SELECT userid FROM user WHERE importuserid = wp_posts.post_author AND wp_posts.post_author > 0), UNIX_TIMESTAMP(post_date), post_content, 1
    	FROM wp_posts
    	WHERE post_type = 'post';
    
    8) Run the various counters in vB, especially usernames, thread info, forum info, and post counts:

    Admin CP -> Maintenance -> Update Counters

    That should result in all of the articles being in the default Main Forum (forumid 2). From there you can import to XF using the vB4 importer:

    http://xenforo.com/community/threads/vbulletin-4-importer-to-xenforo-1-1.23674/

    Each import is a little different, but this is the general process I followed for akia, lucas, and hugo in this thread. I can do yours if you give me a copy of your database.
     
    Eagle, sweetpotato, Sheratan and 2 others like this.
  14. steven s

    steven s Well-Known Member

    I don't have any comments, so that may not be too bad.
    This is a good start. Let me try to do it myself and if I run into problems I'd like to take you up on your offer.
    Thanks!
     
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Same process still.

    The WP importer in ImpEx doesn't do comments, but even if you don't need comments you probably still want to run the manual queries to import the articles as threads. Otherwise the article module in the WP system imports articles as articles, and you probably don't want your articles in the vBCMS. This is assuming you want the articles to eventually be threads on your XF forum in which case you should run the manual queries to import the articles as threads, something that the WP import system doesn't do.
     
  16. steven s

    steven s Well-Known Member

    Excellent! Thank you.
    I found it easier to reinstall vB4 without a prefix.
    Only thing is my import all have html markup.

    <b>BMW</b> confirms that the <b>M135i</b> will be sold in the U.S.
    Is there something that will scrub the html and convert to bbcode?

    And

    Code:
    Are the boffins that have decided not to sell the M135 hatch in the US the same idiots that have decided small diesels won't sell here (while VW/Audi is kicking <b>...</b><br><a style="color:#228822" href="http://www.google.com/url?sa=X&amp;q=http://www.e90post.com/forums/showthread.php?p=11807411&amp;ct=ga&amp;cad=CAcQARgBIAEoBDAAOABA08mQ_QRIAlgAYgVlbi1VUw&amp;cd=sakfGRLUvwc&amp;usg=AFQjCNFNFaDm1dXJvc4DYH_0gBOiRhgxDw" title="http://www.e90post.com/forums/showthread.php?p=11807411">www.e90post.com/forums/showthread.php?p=11807411</a> 
     
  17. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  18. Sheratan

    Sheratan Well-Known Member

    Sorry to bumping this thread.

    After successfully import wp to vb, how do I import vb to xf? In this case, xf database is not empty (forum with users, threads, posts, etc)
     
  19. Jeremy

    Jeremy XenForo Moderator Staff Member

    Run the vBulletin importer. Make sure you uncheck the option to keep IDs.
     
  20. Sheratan

    Sheratan Well-Known Member

    Can I direct the imported thread and post to a some special sub forum?
     

Share This Page