Created a group and a subgroup, and set the subgroup to inherit users from the group. Group currently has no users, so on the subgroup's people page I get the following errors:

Notice: Undefined index: user in _og_subgroups_get_inherited_users() (line 247 of /websites/modules/contrib/og_subgroups/og_subgroups.common.inc).
Warning: Invalid argument supplied for foreach() in _og_subgroups_get_inherited_users() (line 247 of /websites/modules/contrib/og_subgroups/og_subgroups.common.inc).

The offending code is: foreach ($users['user'] as $membership_id => $uid) {

I believe it's assuming the previous line ( $users = og_subgroups_get_users_group($parent_type, $parent_id, $states); ) always returns something and could be corrected by simply adding a check that $users isn't empty first. e.g. if (!empty($users)) {

Comments

naidim created an issue. See original summary.

naidim’s picture

Simple fix, just added a line to ensure $users isn't empty first.

naidim’s picture

Status: Active » Needs review