It all has to do with the arguments to the group class generation… so in your theme, you likely see this:
if (sp_has_groups()) : while (sp_loop_groups()) : sp_the_group();
but we use some optional ordering arguments to the sp_has_group() function call… like this:
$gIds = '';
if(!$spThisUser->member) $gIds = '19,17,6';
if (sp_has_groups($gIds, true)) : while (sp_loop_groups()) : sp_the_group();
so if the current user is not a member, we specifically order the group ids 19 then 17 then 6… notice the change in sp_has_groups() where we now pass the optional ids and the true parameter telling it to order by these IDs…
so for logged in users, it orders it by the order you see on forum – forums – manage groups and forums… when a non member visiting, we order it differently by the specified group ids…