1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

vBulletin (and possibly others) to XenForo Quotes Converter

Discussion in 'Add-on Releases [Archive]' started by brendanc, Oct 25, 2010.

  1. brendanc

    brendanc Active Member

    Hi, I posted a while ago in a thread that I'd be making a script to fix the forum quotes. Well, I've done it.

    I'm positive it works on vBulletin 3.8.x quotes, and possibly others. The format is
    Code:
    [quote=USERNAME;POSTID]
    Note: It also checks your xf_import_log and replaces the old post IDs with the correct new ones, which is necessary if you want the quote linking to work.

    Features
    • (optional) batch processing
    • (optional) verbose output
    • (optional) auto processing.
    One quirk: if you don't provide a limit (i.e. 0), the batch will go all the way through and say Process Next x, x being the # of messages it processed. It's actually already finished, clicking the button or letting it auto process will just take you to the finished page.

    Installation
    1. BACK UP YOUR DATABASE -- As with anything that modifies your data, make sure you have backups!
    2. Put it in your root XF directory.
    3. Run the file in your browser (e.g. example.com/xf_quotes_conversion.php)
    4. Follow the instructions on screen.
    5. Remember to remove the file when you're finished
    P.S. - If this helped you and you're feeling generous, feel free to send me a paypal donation via my email address in the comment of the php file.

    P.P.S - If you have modified this for your bulletin software, send me the changes you made and I'll update the script to have an option for which quote format to use (i.e. PHPBB/SMF/etc).
     

    Attached Files:

  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. brendanc

    brendanc Active Member

    Ah, I missed that. I guess that's pretty much the same thing. This is a little more low level, so maybe it'll find some use on large boards? Either way, thanks for the info.
     
  4. Wired

    Wired Active Member

    Does it import quotes with no postID?
     
  5. brendanc

    brendanc Active Member

    It won't affect quotes with no post id, as those should work fine already. I also just had a thought-- Kier's script doesn't account for changes in post IDs (and can't, for that matter), so this script is still necessary. Woohoo! I almost thought I had reinvented the wheel :O
     
  6. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    Awesome.

    My imported quotes are actually in the XenForo format already so I would just need to replace the post ids. If I modified it to just replace post ids, would it still only affect imported quotes and not new quotes?

    Thanks
     
  7. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    Worked perfectly... Did some tests on a local install first after I made the modifications which involved changing two lines. I would post them but I don't think anyone else is in my position. I used Impex's cleaner.php to fix the quote formatting thinking that the post ids would be the same since I initially did SMF --> vB. Turned out to be a wrong assumption. In the end, I had correct formatting, but wrong post IDs for imported data.

    In any case, I would still recommend backing up your database prior to running this.
     
  8. brendanc

    brendanc Active Member

    I completely neglected to mention this because it's a habit for me. I'll add this as part of the instructions.
     
  9. Jamie

    Jamie Well-Known Member

    Is it possible to adjust this script to account for IPB quotes that weren't imported correctly going from IPB to vB and now in xF the quotes aren't correct?

    This is an example of what I currently have on my test site from the import:


    This is what it should look like:


    I would even be happy if I could get it to quote the name correctly without the snapback like this:


    Do you think something like this can be done with your script?

    Thanks for your help!

    Jamie
     
  10. steven s

    steven s Well-Known Member

    I didn't even realize they were missing.
    I did run into a problem though.
    The script ended with
    Code:
    Fixed Post: [quote="BMW_Hatchback, post: 200762"]forgive me for trying to help a brotha out. But if you want, you can buy 1 from him, and get another one else cheap new maybe on ebay so that way you save money in the end. I've seen some single clear tails on ebay from time to time. Hope that helps[/QUOTE]
    ��������[ys�F�����s$�#    Q�l$]�W6�k#y��T�5F$,�����滿_���;�����:1��������Ӟ|�������2�g����"
    ���U�R��A,�b꽫q�Wz�T�۪�f�d8��&�*�V2/T9��|��    �z�Pb���*�����u^%�G��2�|雁ZFe�f����?E=`⛎~cR]
    Maybe it timed out?
     
  11. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    Since I did something similar with SMF quotes, I'll try to help if I can. I tested the following out and it seemed to work but I'm not familiar with coding so no guarantees. Try it on test data first (obviously).

    Replace line 97 with:
    PHP:
    preg_match_all("/\[quote name=\'[\w\s]+\' timestamp=\'(..........)\' post=\'(\d+)\'\]/i"$post->message$matches);
    Replace line 110 with:
    PHP:
    $qr_query sprintf("SELECT new_id FROM xf_import_log WHERE old_id = %s",$matches[2][$i]);
    Replace line 116 with:
    PHP:
    $search_array = array("[quote name='","' timestamp='",$matches[1][$i],"' post='",$matches[2][$i],"']");
    Replace line 117 with:
    PHP:
    $replace_array = array("[quote=\"",",",""," post: ",$qr->new_id,"\"]");
     
    Jamie likes this.
  12. Jamie

    Jamie Well-Known Member

    That worked! What it did was Quote the name of the person but did not give the snap back link in case anyone is wondering.

    I am fine with this as at least now the conversation flow matches and the quotes don't look funny in the posts!

    Thanks a bunch!

    Jamie
     
  13. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    That's odd... The snapback should be there, there must be something off with my changes. Can you paste what the quotes were converted to?
     
  14. Jamie

    Jamie Well-Known Member

    Sure, are you talking about a screen shot or do you need something different?

    quote.png
     
  15. Jamie

    Jamie Well-Known Member

  16. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    Would like to see the actual BBCode. You can get that by clicking edit and then copy and pasting.
     
  17. Jamie

    Jamie Well-Known Member

    Here is the copy and paste of the image posted above:

    Code:
    [quote="Tom Butler, post: "]
    
    So help me out here.  Are you saying that Jesus' death on the cross  secured salvation for no one?  That his death atoned for no one's sins?    That even though Jesus died on the cross to save sinners, the travail  of his soul did not actually satisfy God?  That it is possible that not  one other soul will be saved before the Lord comes again?
    
    [/quote]
    
     
  18. yoghurtfarmer

    yoghurtfarmer Well-Known Member

    Okay I think I tracked down the issue, I messed up the numbers and references :(. I'll update the old post with the new edit.

    So you should edit the script again to ensure the issue is fixed, import your backup database, then rerun the script.
     
  19. Jamie

    Jamie Well-Known Member

    ok, I will load the backup sometime tomorrow after work and will let you know how it works out.

    Thanks for your help!

    Jamie
     
  20. Anthony Parsons

    Anthony Parsons Well-Known Member

    Just gave this a shot on a vb4 import and worked great...
     

Share This Page