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