Drupal 7 core forum module - plan of attack

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
catch's picture

Drupal's core forum module is much maligned. Some of this is unjustified - people expecting it to replace standalone solutions by itself and ignoring the nature of Drupal's modular framework. However, it also has some limitations which are a result of its age and require many workarounds for large community sites.

Many of the forum module's limitations are down to its dependency on the taxonomy module (making it hard to integrate with organic groups etc.) and on comment.module, which is itself in need of a rewrite.

So we're proposing a ground up rewrite of forum.module using nodes.

Nodes? Surely that would require the pipe dream of comments as nodes? We hear you say.

Well, no it wouldn't. In the new forum module, posts are nodes, and some posts are also forum topics. Forum topics become simply the first post in a thread, and are nothing special by themselves.

We think even forums themselves might become nodes, with the hierarchical structure handled by the menu system - allowing for multiple separate forums, forums within organic groups and the rest.

But if all posts are nodes, won't that be a performance hit?

Well, maybe not. By decoupling forums from the comment system, we no longer have to support comment threading and the rest. Also, most forums have around 10-30 replies per page rather than the 50-100 comments on many blogging sites. The D7 forum module will also depend on views - which will allow us to get all posts in a couple of queries and bypass node_load.

This will make common features in standalone forum solutions readily available: the ability to browse all recent posts by a user (rather than posts they've commented on, not very useful when the thread is 4,000 posts long), splitting and joining topics, rss feeds, subscriptions, uploads, theming - everything can take advantage of the node system without requiring that Joe's single person blog site get the overhead of comments as nodes.

One of the main issues with moving away completely from comments will be the upgrade path, for example some Drupal forums use threading (notably Drupal.org). However, threading on drupal.org has many issues, not least being unable to use #new links when threads get long enough to use a pager.

In terms of an upgrade path for threaded forum discussions, one possible solution would be to mirror the visual structure of threads as they are now, incrementing a reply ID sequentially based on their position, for example:

Current forum thread:
1
  2
    4
      6
    8
3
  5
7

After upgrade:
1
2
4
6
8
3
5
7

We will be attacking the implementation from a few different directions:

  1. Michelle's advforum module is currently providing the glue code and theming that has been much demanded to lower the barrier to a full featured forum solution in Drupal. We'll be working hard on this for D6 as a precursor to more fundamental changes in D7.

  2. data structure. At the moment, it's likely that forums will be nodes, posts will be nodes, and that some posts will also be forum topics. Identifying a topic may be as simply as forum.nid = forum.topic_id - this "everything is a post" model mirrors other forum solutions and gets us away from the comment paradigm.

We know others are interested in working on this, so it'd be great to co-ordinate efforts. Please subscribe to this group and/or get hold of one of us on IRC

For feature lists (some of which will be, or already are handled in contrib) see the advanced forum module wiki.

There's also plenty more background reading in the DruBB group.

For discussion on how to actually get this done, please see the planning wiki

catch, merlinofchaos, Michelle.