• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • 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

brendanc

Active member
#1
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).
 

Attachments

brendanc

Active member
#3
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.
 

brendanc

Active member
#5
Does it import quotes with no postID?
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
 

yoghurtfarmer

Well-known member
#6
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
 

yoghurtfarmer

Well-known member
#7
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.
 

Jamie

Well-known member
#9
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:

[quote name='Donna' timestamp='1289651094' post='20570']

< - Post Snipped for ease of explanation - >

This is what it should look like:

< - Post Snipped for ease of explanation - >

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

Donna said:
< - Post Snipped for ease of explanation - >

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

Thanks for your help!

Jamie
 

steven s

Well-known member
#10
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?
 

yoghurtfarmer

Well-known member
#11
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

Well-known member
#12
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
 

yoghurtfarmer

Well-known member
#13
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
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?
 

Jamie

Well-known member
#17
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]
 

Jamie

Well-known member
#19
ok, I will load the backup sometime tomorrow after work and will let you know how it works out.

Thanks for your help!

Jamie