If you have more groups, this is expensive, as it is querying for groups every iteration. I think it is better to retrieve groups outside the loop using `$adldap->user()->groups()`

I also would use the global recursive_group setting so people can set the recursive setting in config.php