Adding Order to ExpressionEngine’s Forum Subscribe Module

by cosmo

For developers building interactive, membership-focused sites on ExpressionEngine, the Forum Subscribe module is a great addition. It notifies users via email when discussions update, keeping the conversations frequent and involved. I’m currently working with a client to transition users from a Listserv to a forum, and Forum Subscribe makes the process super-smooth.

The module also has some nice front-end hooks to display a list of forums to a logged-in user, indicating their current subscription status on each. Unfortunately, there’s no way for site managers to alter the order for this list of forums, and worse, it doesn’t default to any particular order—not even random.

Long story short, the subscription page gives users an arbitrary, permanent list order for all the forums on your site. Better hope they like it!

Fortunately, there’s an easy fix: add ORDER BY forum_id (or ORDER BY forum_name etc.) to the SQL query in line 51 of mod.forum_subscribe. It should be in the /thirdparty/forum_subscribe/ folder of your EE installation. I’ve posted what the code should look like when you’re done below:
[php firstline=”50″ wraplines=”true”]
// Grab all forums
$forums = $this->EE->db->query("SELECT forum_id, board_id, forum_name, forum_permissions, forum_parent FROM exp_forums WHERE board_id = {$board_id} AND forum_is_cat = ‘n’ AND forum_status = ‘o’ ORDER BY forum_id");

I’m not big on hard rules or policies online— “best” practices are only best until they aren’t—but I’m having a hard time coming up with any case where displaying a set of elements without any order (including an explicitly randomized order) is desirable. If it appears to users on the site, you’ve got to be able to have some say over how it looks.

For me, it’s not a big deal to go meandering through a few hundred lines undocumented (if entertainingly commented) PHP, identify the appropriate query, and then make the fix, but I think most clients and resellers would have a hard time executing a similar change. Food for thought for CMS developers everywhere.