Importing a phpBB Forum Into Xaraya 09.13.2005

Article Summary

The predecessor to the current CMS-enhanced version of TAMUSigmas.org was a message board implemented by phpBB. Though there is an import tool that can be used import whole phpBB forums into Xaraya, I encountered some difficulties using it.

Located in the tools directory of the Xaraya installation package is a group of tools that can be used to import data from various open-source software packages. The import tools for phpBB are located in the tools/phpbb directory. In order to get the import tool to run:

  1. Copy the tools/phpbb directory over to the root directory of your Xaray installation.
  2. Run the tool in your web browser by visiting the url http://www.mywebsite.com/tools/phpbb/import_phpbb.php.
  3. Follow the instructions that appear in the resulting page.

The import process works pretty well, except for a few issues:

  • Quoted entries were proceeded by a random sequence of numbers that looked very much out of place.
  • User and group permissions are not imported.
  • Category information is not imported.

Quoted Entries

What are the Numbers for?

My guess is that they were somehow used to refer to the user name of the person who was being quoted, but I never could find a way that the number related to any of the user names on the site, since none of the numbers matched any of the unique ID numbers assigned to any of the users.

How was the Problem Resolved?

At first I thought I'd just go through the database and remove the numbers by hand, but there were way too many and I knew I'd end up missing some, so I wrote some PHP code to automate the process. After running the import tool, I uploaded and ran the following PHP code I've attached in this file. All the code does is:

  1. open up a database connection (the connection information is set up as variables at the beginning of the file)
  2. search through the imported forum posts in the Xaraya database
  3. figure out which ones have the BBCode tag [quote=XXXXXX] (where XXXXXX is any random assortment of numbers)
  4. use regular expressions to detect the number and remove it from the post
  5. update the database and exit

This file is here for you to use freely, and can be distributed freely as well. Before it's used however, make sure you backup your Xaraya database. In case things go awry, having a backup will make bringing your site back online much easier.

In order to run the file, you must:

  1. rename the file by giving it a .php extension
  2. upload the file to the Xaraya directory on your web server
  3. open up your web browser and run the file from the location bar

Once it's finished running, the file while show you a list of the queries it ran along with a listing of the posts it updated.

User and Group Permissions

The Problem

One of the most helpful qualities of the import tool is that it imports your list of phpBB users into Xaraya's Roles module. Unfortunately, information about group membership, permissions, and ranks are not transferred, so one must transfer this information manually.

The Solution

Make sure that you don't delete your phpBB installation until you've had a chance to transfer your settings over to Xaraya. Keep the phpBB installation around until your site goes into production, then keep a backup of it just in case something goes wrong.

Group membership in phpBB is similar to group membership in Xaraya. You use the Roles module in Xaraya's administration interface to create your groups, and then you can add users to those groups. Using groups makes managing permissions easier, because you can assign permissions to a group, which will cascade down to all the group's members. This is more efficient than having to individually edit permissions for every user on your site. Succinctly:

  1. Add your existing groups to the site manually by going to the "Add Group/User" option for the Roles module.
  2. Choose the "View Groups/Users" option from the Roles module.
  3. Add users to their respective groups by clicking on the "Modify this User" link next to their name.
  4. On the resulting page, look for the "Add User 'User Name' to a Group" heading, and change the value of the "Group" select box underneath it to the desired value.
  5. Repeat for all users.
  6. Proceed to the administration interface for the Privileges module, and set up XarBB preferences for your groups. The Xaraya Privileges Mini-HOWTO is a helpful guide to learning about groups, roles, and privileges, as is the Module Overview for the Privileges module.

If you have a lot of users, there's undoubtedly a way this operation could be performed programmatically in PHP instead of manually — I just haven't had the time to think of a way to do it yet. It shouldn't be very difficult to try for those of you familiar with mySQL and PHP though.

Forum Categories

The Problem

In phpBB, forum categories are used to organize forums into groups. Xaraya has a similar setup, however the import tool that comes with Xaraya does not transfer the categories over. Therefore, the categories will have to be added manually, and the forums associated with them have to be connected through Xaraya's administration interface.

The Solution
  1. Go to the administration panel for the Categories module and click on the "Add Category" option.
  2. Create a parent category to hold all of your forum categories (choose whatever name you like).
  3. Select the "Add Cateogry" option again.
  4. In the "Create in a batch" text box, enter the number of forum categories from your phpBB installation.
  5. On the resulting screen, enter the names of each of your phpBB categories.
  6. Before submitting these names, change the "In relation to this category" selection to the name of the very first category you submitted for each of the category names.
  7. In the "Position" selection, choose either "The first child category" or "The last child category". The setting you choose will depend on what order you want your categories to be displayed in. If necessary, you can edit the names at this step to get the categories in your preferred order.
  8. Submit the form.
  9. Go to the administration interface for the XarBB module and select the "Modify Config" option.
  10. On the resulting page, in the "Number of possible categories" input box, type in the number of forum categories you have on your site and submit the form.
  11. When the page reloads, you'll see four select boxes labeled "Base category for xarbb," select a different category for each of these select boxes.
  12. Click on the "View" option for the XarBB module from the side menu.
  13. Click on the first forum name listed.
  14. Under "Categories" on the resulting page, you'll see a number of boxes with the different category selections, choose the correct category for this forum from one of these boxes and submit the form.
  15. Select another forum from the list at the top of the page, and repeat step 13 until you've assigned all forums to a category.

Conclusion

Hopefully, for those of you contemplating moving a phpBB forum over to Xaraya, this tutorial will be of assistance to you. For further customization, explore the administration screens of the XarBB, Privileges, Roles, and Categories modules further, and do a search for XarBB on the forums over at Xaraya.com.