Update invite.php

get $group and checks on $group now outside the foreach.