In a recent project we had to implement a uniform commenting system across the site, Jomsocial included. Now obviously, Jomsocial comes with it’s own commenting system, and to make matters worse, there were already thousands of comments already present that needed to be migrated to the new platform.
We suggested the use of Disqus, which is a cloud based commenting system that easily integrates with a website. Thankfully, DISQUS provides a way to import comments from non-compatible systems by importing from a WXR file.
So the first challenge was to generate a WXR file. Each thread in DISQUS needs to have a unique disqus_thread_id, which is usually unique per page. In case of comments for Joomla Articles, this is usually the article ID. However, since we were using DISQUS for videos, photos and even blogs, we could have easily run into an issue where a video, a photo and a blog have the same id. To overcome this, we prefixed the id with a identifier, so the ID became video.345 or photo.345 or blog.345 Neat eh ;)
Once this architectural challenge was out of the way, it was as simple as writing a script to output a WXR file, and then importing the WXR file into DISQUS. Below is how we wrote a neat little script to generate the file -
WXR Export Script
To create a WXR file for jomsocial videos, we created a disqusimport.php controller and loaded it with the code to create the WXR. Placed this controller in com_community and we were good to fire the exporter. You could of course also create a neat little CLI script to do that....