Skip to content

Commit 095b21d

Browse files
committed
fixed: using deprecated group_acl metadata
1 parent aa03da8 commit 095b21d

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

lib/functions.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function questions_validate_access_id($access_id, $container_guid) {
128128
} else {
129129
// make sure access_id is not a group acl
130130
$acl = get_access_collection($access_id);
131-
if (!empty($acl) && ($acl->owner_guid != $container->getGUID())) {
131+
if ($acl instanceof ElggAccessCollection && ($acl->owner_guid != $container->guid)) {
132132
// this acl is a group acl, so set to something else
133133
$access_id = ACCESS_LOGGED_IN;
134134
}
@@ -139,17 +139,27 @@ function questions_validate_access_id($access_id, $container_guid) {
139139
if ($group_access_id !== false) {
140140
$access_id = $group_access_id;
141141
} else {
142+
$group_acl = $container->getOwnedAccessCollection('group_acl');
143+
142144
// friends access not allowed in groups
143145
if ($access_id === ACCESS_FRIENDS) {
144-
// so set it to group access
145-
$access_id = (int) $container->group_acl;
146+
if ($group_acl instanceof ElggAccessCollection) {
147+
// so set it to group access
148+
$access_id = (int) $group_acl->id;
149+
} else {
150+
$access_id = ACCESS_LOGGED_IN;
151+
}
146152
}
147153

148154
// check if access is an acl
149155
$acl = get_access_collection($access_id);
150-
if (!empty($acl) && ($acl->owner_guid != $container->getGUID())) {
156+
if ($acl instanceof ElggAccessCollection && ($acl->owner_guid !== $container->guid)) {
151157
// this acl is an acl, make sure it's the group acl
152-
$access_id = (int) $container->group_acl;
158+
if ($group_acl instanceof ElggAccessCollection) {
159+
$access_id = (int) $group_acl->id;
160+
} else {
161+
$access_id = ACCESS_LOGGED_IN;
162+
}
153163
}
154164
}
155165
}
@@ -198,8 +208,11 @@ function questions_get_group_access_level(ElggGroup $group) {
198208
}
199209

200210
if ($plugin_setting) {
201-
if ($plugin_setting == 'group_acl') {
202-
$result = (int) $group->group_acl;
211+
if ($plugin_setting === 'group_acl') {
212+
$acl = $group->getOwnedAccessCollection('group_acl');
213+
if ($acl instanceof ElggAccessCollection) {
214+
$result = (int) $acl->id;
215+
}
203216
} else {
204217
$result = (int) $plugin_setting;
205218
}

0 commit comments

Comments
 (0)