MyBB Community Forums

Full Version: phpBB 3.0.12 Conversion of URL's and Attachments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've just converted from phpBB and have a couple of issues that are immediately obvious.

1) URL's (previously [url][/url] tags) have not converted and look like:

<!-- m --><a class="postlink" href="http://www.blah.com/projects/1461411552/elite-dangerous?ref=live">http://www.blah.com/projects/146 ... s?ref=live</a><!-- m -->

Fixed with another script on the forum.

2) Attachments (previously embedded images) show like this:
[Image: ykto.png]

Attachments resolved with script here


Any ideas please?
I would like to know how you solved the first problem with the URLs. I have the same issue. Also if there's a way to fix the [youtube] bbcode tags so they work that would rock. It was used a lot and now those embed codes are all broken and displaying as text.

On the second attempt my attachments came across (renamed the htaccess files temporarily to disable them) so the thumbnails show and the attachments are all there, but the posts still have those [attachment=1] etc tags in them. Is there a way to fix/remove them?
I used this function to fix the URL's: http://community.mybb.com/thread-104182-...#pid759472

Worked perfectly Smile

For the YouTube code I was using the code format
[youtube]id[/youtube]
on phpBB originally, so all I needed to do was add a new BBCode entry, like this:

Regular Expresssion:
\[youtube\](.*?)\[/youtube\]

Replacement:
<div style="margin:0;padding:0;width:512px;"><div style="float:right;"><button onclick="MyBB.popupWindow('http://www.youtube.com/watch_popup?v=$1','youtube_$1',640,480);" style="background:url(http://s.ytimg.com/yt/img/master-vfl102488.png) 0 -658px;border:0;height:22px;width:27px;" /></div><object type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1&amp;fs=1&amp;rel=0" width="512" height="384"><param name="movie" value="http://www.youtube.com/v/$1&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /></object></div>

The attachments clean up needed a little more work since I'm not clued up enough to write a proper script.

I wanted the attachments properly embedded so I ran this to give the me posts that needed editing and the attachment ID's ("aid") that needed inserting:

SELECT * 
FROM mybb_posts
LEFT JOIN mybb_attachments ON mybb_posts.pid = mybb_attachments.pid
WHERE mybb_posts.message LIKE  "%[attach%"

. . . then bodged together a load of update scripts in Excel to put the right "aid" in the right place. Since I only had 300 odd attachments it wasn't too painful. The only problem then is that they don't appear in the right order in the post, so some manual work was required to tidy them up. If you don't care about the order, then it won't be an issue.

It's a shame the original conversion didn't work as well as I'd hoped.
Thanks for the detailed reply, I'll report back how it goes for me.
I haven't had much time yet and only looked at the youtube tags so far. Couldn't get it to work. It would never display the video though it would show the div and reserve the space. Then after a while I realized I can do it a lot simpler. On my forum not just the ID was used, it was always the whole URL.

\[youtube\](.*?)\[/youtube\]
replace with
[video=youtube]$1[/video]

That works. Doesn't give me control of the size and such, but I couldn't figure out what was wrong with the other embed code. I tried to modify yours and grabbed a fresh one from youtube but no go. It's like the $1 variable wouldn't work.