MyBB Community Forums

Full Version: how to sort forums in category aphabetically
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am using the newest 1.8 bits on a new installation.  I have a somewhat large number of forums I am trying to add to a category and would like to be able to have all the forums appear sorted alphabetically.  Is this possible?

I tried setting "View Options->Default Sort By" for the Category to "Thread Subject" but that didnt seem to work.  I also set all the "Order" entries to 1.  (I tried zero also, but no change.)

Am I missing something?

I found a quick hack that, barring a better solution, seems to work.    In the file index.php there is a section like this:

else
{
        // Build a forum cache.
        $query = $db->query("
                SELECT f.*, fr.dateline AS lastread
                FROM ".TABLE_PREFIX."forums f
                LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid = f.fid AND fr.uid = '{$mybb->user['uid']}')
                WHERE f.active != 0
                ORDER BY pid, disporder
        ");
}

Simply change the ORDER line to this

               ORDER BY pid, disporder, name

It looks like forum names will generally be displayed as they were before, except when they have the same order number.  In that case, they will be sorted alphabetically.  So for example, everything with order == 1 will be sorted alphabetically.  If you make several groups of items with the same order, each group will be sorted separately and the groups will be displayed in numerical order.

Well, seems to work for me.  Any advice about possible repercussions much appreciated as is any way to do this without editing php code.
It worked for me as well. Thanx