
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)) {
Comment | File | Size | Author |
---|---|---|---|
#2 | 2974531-Assumes-users-exist-if-inheritance-set.patch | 1.56 KB | naidim |
Comments
Comment #2
naidim CreditAttribution: naidim as a volunteer commentedSimple fix, just added a line to ensure $users isn't empty first.
Comment #3
naidim CreditAttribution: naidim as a volunteer commented