Xenforo Import: Pre-existing Topic & Post ids

AI-generated summary

In a discussion titled “Xenforo Import: Pre-existing Topic & Post ids” under the Self-hosting category, dantreacy shares their experience importing a large Xenforo forum (approx. 250,000 posts) into Discourse, praising the importer’s smoothness. They ask whether the original Xenforo topic and post IDs are preserved or mapped to new Discourse IDs during or after import, noting they’ve seen references to import_ids in the script but suspect they’re temporary. As a non-Ruby expert, they’re unsure if they’ve overlooked something. They want to maintain working links to old threads across multiple forum migrations (PunBB, IPS, VB, Xenforo) and seek guidance on how to achieve this in Discourse. pfaffman replies that old IDs are stored in PostCustomFields during import and suggests reviewing the Vbulletin importer for examples of Permalinks, which allow mapping legacy URLs to new Discourse topics using regex-based “permalink normalizations” — enabling URL patterns like /oldtopic/<topic_id> to redirect correctly even with complex legacy query strings.

Hi Folks,

Have an exisitng Xenforo forum with roughly quarter million posts.

Few days ago I trialled an import into Discourse.

First off congrats to all who’ve worked on the script, was one of the most trouble free imports from one forum software to another that I’ve undertaken.

That said I have a couple of questions.

I’ll preface this by saying that Ruby isn’t my natural habitat by a long shot, so it’s entirely likely there’s some translation issues here and I’ve missed something obvious. Apologies if that’s the case.

I’m looking to see if during (or even after) the import, the topic/post ids from the previous forum (in this case xenforo) are stored anywhere or linked in any way to the new discourse ids.

In my searching I saw some mention of it for Vbulletin and reading the XF (and eventually base) import script I see it import_ids referred to fairly frequently but they all seem to be emphemeral vars used during the import process then discarded (although as I said no expert at Ruby so might be getting that horribly wrong)

My forum has been around for quite some time and has gone few a few iterations, PunBB, IPS, VB and now Xenforo, but most of the time I’ve been able to keep links to old threads etc active through a few simple custom scripts. (of course that simplicity there was offset by most of those migrations being far more painful ;)) I’d like to do the same here except I’m lacking some sort of mapping from old topic to new or a DB field referencing the old topic id.

At least I think I am, it might be there but I can’t seem to find it :slight_smile:

Happy to contribute what I come up with back to the masses at large just need some street signs pointing me in the right direction.

Thanks.

The old IDs are in PostCustomFields and are created as part of the importer.

You can have a look at other importers that create Permalinks. The Vbulletin one is an example. The other thing you’ll want to take note of is “permalink normalizations”, a regex that is applied before permalink matching is done. That lets you do stuff like create a permalink like '/oldtopic/<topic_id>" that you can make match /topic/blah.php?xdfj=<topic_id>#93m3lsdfj with a regex.