Goodbye vBulletin, part two: how we got away

The previous article in this series showed our reasons for wanting to move The Webmaster Forums from vBulletin to Drupal. This second part shows how we successfully got away, and the difficulties faced.

The easiest way to explain The Webmaster Forums' feature set is by listing the modules used, with explanations of what they are for. Following that is a rough guide to theming forums.

Note: vBulletin™ is a registered trademark of vBulletin Solutions. aPaddedCell, the Webmaster Forums are not affiliated with them nor do we speak for them in any way.

Modules

Following is a list of the modules in use on The Webmaster Forums. This is not an exhaustive list, just the modules relevant to running the forums. Also, where it makes sense, groups of modules are show as one (Views, Views UI, Views export are just shown as Views, for example). Details on how modules are used is shown below the table, click the links in the table to jump to the detail.

Access control
Name Description
ACL Access control list API. Has no features on its own.
Forum Access Allows forums to be set private and allows forums to be given moderators
Ad
Name Description
Ad An advertising system for Drupal powered websites.
Core - optional
Name Description
Comment Allows users to comment on and discuss published content.
Contact Enables the use of both personal and site-wide contact forms.
Forum Enables threaded discussions about general topics.
Menu Allows administrators to customize the site navigation menu.
Path Allows users to rename URLs.
Poll Allows your site to capture votes on different topics in the form of multiple choice questions.
Profile Supports configurable user profiles.
Search Enables site-wide keyword searching.
Syslog Logs and records system events to syslog.
Taxonomy Enables the categorization of content.
Tracker Enables tracking of recent posts for users.
Update status Checks the status of available updates for Drupal and your installed modules and themes.
Upload Allows users to upload and attach files to content.
Flags
Name Description
Flag Create customized flags that users can set on content.
Mail
Name Description
Private messages Allow private messages between users.
Messaging
Name Description
Messaging Messaging system. This is the base module for the Messaging Framework
Simple mail Mail Sending Method: Integration with Drupal mail API.
Migration
Name Description
vBulletin Passwords Converts vBulletin to Drupal users as they login.
Notifications
Name Description
Content Notifications Allows users to subscribe to content related events.
Notifications The basic notifications framework
Notifications Autosubscribe Provides automatic notifications.
Notifications UI Provides an UI to notifications
Other
Name Description
BBCode Allow the use of BBCode in your posts.
Better Formats Enhances the core input format system by managing input format defaults and settings.
Code Filter Provides tags for automatically escaping and formatting large pieces of code.
Comment mover Move comments to other threads or convert them to nodes.
Comment upload Enables file attachments on comments.
Custom Miscellaneous code snippets.
Fasttoggle Enables fast toggling of binary settings.
Global Redirect Searches for an alias of the current URL and 301 redirects if found. Stops duplicate content arising when path module is enabled.
Pathauto Provides a mechanism for modules to automatically generate aliases for the content they manage.
Quick Tabs Create blocks of tabbed views, blocks and nodes.
Quote Allows users to quote posts or comments.
Signatures for Forums Tweaks signatures in ways inspired by other traditional forum software.
Site Verification Verifies ownership of a site for use with search engines.
Token Provides a shared API for replacement of textual placeholders with actual data.
User badges Enables assignment of graphical badges to users and roles.
User Stats Provides post count and other user statistics. Integrates well with Token and Advanced Forum (if installed).
Video Filter Filter to include videos from Youtube, Google video etc
Rules
Name Description
Rules Lets you define conditionally executed actions based on occurring events.
Smileys
Name Description
Smileys Replaces smileys inside posts with images.
Spam control
Name Description
CAPTCHA Base CAPTCHA module for adding challenges to arbitrary forms.
reCAPTCHA Uses the reCAPTCHA web service to improve the CAPTCHA system.
Statistics
Name Description
Piwik - Web analytics Adds Piwik javascript tracking code to all your site's pages.
User Interface
Name Description
Wysiwyg Allows users to edit contents with client-side editors.
Views
Name Description
Views The views module creates customized views of node lists.
Views Bulk Operations Exposes new Views style 'Bulk Operations' for selecting multiple nodes and applying operations on them.
XML Sitemap
Name Description
XML Sitemap Creates an XML site map in accordance with the sitemaps.org specification.
XML sitemap node Adds content links to the site map.
XML sitemap taxonomy Adds taxonomy term links to the site map.

Access control

ACL and Forum Access are used for hidden and restricted-access forums, such as Market Place where only active members of the community are allowed to post topics, and the ‘Members Only’ forums.

These modules are not required if the forum is a simple one, with no hidden areas or user roles.

Somewhat self-explanatory, the Ad module is used to display adverts on the site (though we try to keep these at a minimum). This module is good for hosting and administrating your own adverts. Note: for Google AdSense™ try the AdSense module.

Flag

Flag is a versatile module, we have many ideas for features that can be based on it (like/dislike posts, agree/disagree and more), but currently it is for flagging posts and users as spam for moderator review and for marking topics as Favourites. Views is then used to generate a list of reported users, topics and posts.

Mail

Private messages allows users to send each other messages via a Web-based interface on the site. vBulletin has this built-in, so many frequenters of forums expect this functionality.

Messaging

Messaging is a framework for sending messages to users via a range of methods, including SMS, e-mail, and Private messages. These modules are required for Notifications. We use Simple Mail to send topic update notifications (known as subscriptions in vBulletin), via e-mail, to users.

vBulletin Passwords (and vBulletin to Drupal)

vBulletin Passwords allows vBulletin users to log in to Drupal without having to reset their passwords. vBulletin to Drupal was used to initially import data from vBulletin to Drupal forums, but is not included in this list since it was disabled after its job was done.

Notifications

Notifications allows users to subscribe to content and receive alerts (via e-mail, private message, SMS and any other method supported by the Messaging framework) when it changes. The Webmaster Forums use this module to send e-mail alerts when someone replies to a forum topic.

BBCode

BBCode has been used on forums as a simple HTML replacement for many years, the BBCode module allows users to include it in their posts.

For anyone are unaware of what BBCode is and its purpose, see this BBCode reference site.

Better Formats

Better Formats is used to provide different default input formats per user group; letting us prevent new members from posting links (and therefore spam).

Code filter

Being a technical forum, users often post code samples they need help with. The Code Filter module provides some code formatting and highlighting for PHP.

Anyone running a forum for non-technical users will probably not require this module.

Comment mover

Forum topics consist of a forum node and comments as replies. The comment mover module splits and merges forum topics. There is a big warning on the project page, but the module works sufficiently well and has no obvious security holes.

Comment upload

The core Upload module allows uploading files and attaching them to nodes, unfortunately there is no built-in way to upload files to comments. The Comment upload module fills the gap.

Note: this module becomes redundant in Drupal 7, Fields can now be added to comments.

Custom

Most sites need somewhere to put miscellaneous code snippets and tweaks to things (like forms) it is not possible to alter in the theme. On the Webmaster Forums that module happens to be called Custom, it can have any name though.

The two parts of the module that may be of interest to forum builders:

<?php
/**
* Implements hook_theme_registry_alter().
*/
function custom_theme_registry_alter(&$theme_registry) {
  unset(
$theme_registry['forum_topic_navigation']);
}
?>

This removes the previous/next topic links beneath a forum topic’s first post. Not only are these superfluous but the database query to generate them is expensive.

<?php
/**
* Implements hook_link_alter().
*/
function custom_link_alter(&$links, $node, $comment = null) {
  global
$user;

  if (isset(
$links['comment_forbidden'])) {
    unset(
$links['comment_forbidden']);
  }
}
?>

By default an anonymous user sees, ‘Login or register to post comments’ after every comment, this interrupts the flow of reading and is distracting. The above code removes these links, see the theme section below to see how we replaced these with a single message after the comments.

Fasttoggle

Fasttoggle is a boon for forum moderators and administrators. With a single-click it unpublishes a forum post, makes a topic sticky or promotes a topic to the front page. Fasttoggle uses AJAX so no page reloads are required. It is used on the Webmaster Forums to unpublish spam and promote interesting topics to the front page (where they are displayed in the ‘Highlighted topics’ block).

Global Redirect

Global Redirect prevents duplicate content being accessible when using path aliases (a.k.a. ‘search engine friendly URLs’). When a user or bot tries to visit a Drupal URL, Global Redirect will redirect them to the corresponding search engine friendly URL, for example: http://www.example.com/node/1234 might be redirected to http://www.example.com/example-friendly-url.

Pathauto

Pathauto is an indispensable module for automatically creating pretty URLs for forum topics. It’s also useful for creating URLs that include keywords, for search engine optimization.

Quicktabs

Quicktabs is used to created a tabbed interface for displaying a user's topics and comments on the user profile page.

Quote

The quote module provides a quote button for forum posts and automatically copies and pastes the post being replied to — in [quote] tags — to the post being written.

Signatures for Forums

This module was written for the Webmaster Forums, to tweak post signatures so they function similarly to vBulletin’s. Drupal signatures do not update automatically (in version five), and are shorter than vBulletin’s. Signatures for Forums provides many other options, such as only showing a signature once per conversation, an input format selection for signatures, only showing a signature if a post is over a certain length and more.

Site Verification

For putting in the code to verify your site for Webmaster Tools. See the Site Verification project page.

Token

Token is required for Ad, Notifications and Pathauto. This only needs to be installed if a module asks for it.

User badges

As the name implies, this module is for showing badges next to posts written by moderators and admins (or any other user role).

User Stats

Another module written specifically for the Webmaster Forums, User Stats provides statistics useful to forums, such as post count and log in count. See the An Introduction to the User Stats Module for Drupal for information on installing this module.

The Webmaster Forums has areas only available to members with a certain number of posts, and have been members for some time (see the Market Place forums). This was made possible by integrating User Stats with Token and Rules, then using the integration with Rules to give users extra roles when they have reached the requisite number of posts, or have been members for a certain number of days.

Video filter

Used for easily including YouTubeâ„¢, and other video providers’, videos in forum posts.

Rules

See also how we use User Stats. Used to automatically add roles to users when they reach a certain post count and/or have been members for a number of days. It also displays messages to users trying to post in areas they lack the permissions to do so, automatically prunes Market Place forums and unpublishes Website critique topics, which are then checked by the moderators to see whether the user has met the requirements of posting reviews for other sites before getting their own critiqued.

Smileys

The smiley module converts text smileys (such as :) :O :( etc.) into associated images.

Spam control (CAPTCHA and reCAPTCHA)

These modules protect against automated sign-ups to the forums, which would be used by spam bots to post advertising. These are a necessary evil, due to the volume of automated spam attacks sites must defend against.

Even with protection against automated attacks, spammers will find ways to post links (often in nefarious and cunning ways). Using the Spam module helps prevents this.

Piwik

The Piwik enables collection of site statistics using the open source web analytics tool by the same name.

In addition to the standard statistics, Piwik goals are also used to analyze how people use the site, which can be used to improve the site. For example, to find how many users are following the login form’s register link, and of them how many are signing up, goals were created in Piwik and the following code put in the theme:

Drupal.behaviors.newUserTracking = function() {
  // Login block register link.
  $('.block #user-login-form a[href="/user/register"]').click(function() {
    Drupal.twfGoalTracking(9);
  });
  // Pressed submit button on user register form.
  $('#user-register input#edit-submit').click(function() {
    Drupal.twfGoalTracking(6);
  });
}

Drupal.twfGoalTracking = function(goalId) {
  var u=(("https:" == document.location.protocol) ? "https://piwik.webmaster-forums.net/" : "http://piwik.webmaster-forums.net/");
  var twfTracker = twfTracker || Piwik.getTracker(u+'piwik.php', 1);
  twfTracker.trackGoal(goalId);
}

9 and 6 are the unique ids of the goals in Piwik that should be triggered. This will change from goal to goal, see the Piwik goals documentation to find goal ids.

Wysiwyg

Wysiwyg and the Markitup! editor are used on node creation and comment forms. Markitup! is quite simple, inserting HTML into the post textarea. It is safe to assume our users know HTML, so we decided to keep it simple. Different types of sites should pick the editor that best fits their users’ needs.

Views

Views needs little introduction, as it is an integral part of most Drupal Web sites, and the Webmaster Forums is no exception. The list below shows some of the most used Views on the forums:

  • Highlighted topics (on the front page);
  • Recent posts and the other tabs under that page;
  • Favourites, which also uses Flag to add items to a user’s favourites list (http://www.webmaster-forums.net/favourites — must be logged-in to see this page);
  • Users’ recent topics and recent comments on user profile pages, displayed using Quicktabs (views of unpublished topics and comments are visible to moderators);
  • Posts flagged as spam;
  • Website Critique area topics that have yet to be released;

Views Bulk Operations

Views bulk operations is an add-on for views that allows you to perform operations on many nodes, comments, or users at once. You can select individal nodes, or all nodes in the view. The Webmaster Forums uses this for many administrative tools, including customized content, comment, and user admin pages.

XML Sitemap

Any site concerned with search engine opimization needs this module. XML Sitemap provides a list of pages on a Drupal site, in a format search engines can read.

Special note: Drush

Another site management project it’s impossible to ignore is Drush. This module is a must-try for those who enjoy the efficiency of the command line.

For example: a site with modules with updates can be upgraded with the command: drush up. No downloading tar files or update.php required!

Creating a Forum Theme

Drupal’s PHPTemplate theme engine is capable of far more than many give it credit for. It certainly takes far less time to create a table-less forum theme than other systems; more importantly our theme has required no changes after minor releases of Drupal or modules.

Drupal 6

The Webmaster Forums was originally built on Drupal 5 and was upgraded to Drupal 6 in December 2009. While Drupal 7 has been released — and is an excellent peice of software — not all modules required for forums have been ported yet.

Following are instructions for creating a theme for Drupal’s core forums, the Webmaster Forums’ code is not in a state where we wish to share it, so the templates provided by Drupal are a better starting point.

The Core templates list contains links to the files that will serve as a starting point to theming a forum. To override a theme file, find it in that list, click on the link to it, click ‘View source’ and copy/paste that source into a file with the same name in the site’s theme directory. For example: to override forum-list.tpl.php on a site with a theme called example, copy and paste the contents of the forum-list.tpl.php file from the list into sites/all/themes/example/forum-list.tpl.php.

Templates give access to internal Drupal variables containing information relevant to that template. These variables are essential to theming and are documented within the template source code. For example, forum-list.tpl.php has this variable documentation:

Available variables:
- $forums: An array of forums and containers to display. It is keyed to the
  numeric id's of all child forums and containers.
- $forum_id: Forum id for the current forum. Parent to all items within
  the $forums array.

Each $forum in $forums contains:
- $forum->is_container: Is TRUE if the forum can contain other forums. Is
  FALSE if the forum can contain only topics.
- $forum->depth: How deep the forum is in the current hierarchy.
- $forum->zebra: 'even' or 'odd' string used for row class.
- $forum->name: The name of the forum.
- $forum->link: The URL to link to this forum.
- $forum->description: The description of this forum.
- $forum->new_topics: True if the forum contains unread posts.
- $forum->new_url: A URL to the forum's unread posts.
- $forum->new_text: Text for the above URL which tells how many new posts.
- $forum->old_topics: A count of posts that have already been read.
- $forum->num_posts: The total number of posts in the forum.
- $forum->last_reply: Text representing the last time a forum was posted or
  commented in.

Using these variables and the template code already provided by Drupal it is possible to make forums that really shine!

Forum home page

The template file that controls the top-level list of forums is: forum-list.tpl.php.

Forum threads

Forum threads consist of both nodes and comments, special templates theme only forum nodes and forum comments: node-forum.tpl.php and comment-forum.tpl.php. These template files may be created by copying node.tpl.php and comment.tpl.php, then edited to suit.

Replacement for ‘Login or register to post comments’

The custom module above removes the ‘Login or register to post comments’ link on every comment, these are replaced with the more elegant, single message beneath the comments:

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.

(this is just a screenshot)

This was achieved by putting the following code into comment-wrapper.tpl.php:
  <?php if (!$logged_in): ?>
    <?php $options = array('query' => drupal_get_destination() . urlencode('#comment-form')); ?>
    <p id="anonymous-signup-encouragement"><?php print t('Want to join the discussion? <a href="@create-account" id="signup-link" rel="nofollow">Create an account</a> or <a href="@log-in" rel="nofollow">log in</a> if you already have one. Joining is fast, free and painless! We&rsquo;ll even whisk you back here when you&rsquo;ve finished.', array('@create-account' => url('user/register', $options), '@log-in' => url('user/login', $options))); ?></p>
  <?php endif; ?>

Drupal 7

A new article describing how to build Drupal 7 forums will be published after the Webmaster Forums have been upgraded.

Corrections and errata

It has been some time since the first article, detailing the reasons for our move away from vBulletin, was written. Many things have changed since then and not all of the criticisms of vBulletin were (or are) valid. Following are some corrections to the first article and some notes on how vBulletin has evolved since 2007.

  • vBulletin’s templates are now table-less, good news for its users.
  • The previous article mentioned vBulletin appears to have more security advisories than Drupal, with the caveat that was just a personal experience, this turned out to be untrue, in fact vBulletin’s open reporting of security bugs is just as good as Drupal. It certainly could be much worse.
  • The previous article mentioned performance as a reason to switch to Drupal, however it should be noted that Drupal’s modularity and installing a large number of modules will slow it down.

That said, the other points still stand and the Webmaster Forums do not regret moving to Drupal.

Resources

Discussion

To discuss this article or ask questions, please visit The Webmaster Forums discussion on Goodbye vBulletin, part two: how we got away.

About the Author

Liam McDermott is the technical bod at The Webmaster Forums. He also writes articles and loves dallying with Drupal. His business site is InterMedia.