$forumcheck = end($vbulletin->forumcache); if (!$forumcheck['sorted']) { function forumsort($forum1, $forum2) { if ($forum1['displayorder'] == $forum2['displayorder']) { return strnatcasecmp($forum1['title_clean'], $forum2['title_clean']); } return ($forum1['displayorder'] < $forum2['displayorder']) ? -1 : 1; } uasort($vbulletin->forumcache, 'forumsort'); $lastforum = end($vbulletin->forumcache); $vbulletin->forumcache["$lastforum[forumid]"]['sorted'] = 1; build_datastore('forumcache', serialize($vbulletin->forumcache)); }