[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Undefined array key id warning in wikiplugin_group.php
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <690e264e3ddf8_2c854ce5c7879c@gitlab-sidekiq-low-urgency-cpu-bound-v2-75f5bb84f4-nn2f5.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
f51d16e7 by David Maene at 2025-11-07T16:54:41+00:00
[FIX] Undefined array key id warning in wikiplugin_group.php
---
* [FIX] Conflict: reolve from master
* from master
* [FIX] diplication code in wikiplugin_group.php
* [FIX] diplication code in wikiplugin_group.php
* [FIX] diplication code in wikiplugin_group.php
* [FIX] Admin dashboard - Look & Feel - Layout: changed how the selected option...
---
* [FIX] Admin dashboard - Look & Feel - Layout: changed how the selected option is retrieved to avoid getting a null when the field is disabled.
See merge request tikiwiki/tiki!8907
See merge request tikiwiki/tiki!8618
- - - - -
1 changed file:
- lib/wiki-plugins/wikiplugin_group.php
Changes:
=====================================
lib/wiki-plugins/wikiplugin_group.php
=====================================
@@ -78,6 +78,20 @@ function wikiplugin_group_info()
];
}
+function filterGroups(array $groupsList, bool $shouldExist, array $attributes): array
+{
+ $result = [];
+ $userlib = TikiLib::lib('user');
+ foreach ($groupsList as $grp) {
+ $grpinfo = $userlib->get_group_info($grp);
+ $attname = 'tiki.memberextend.' . $grpinfo['id'];
+ if ($shouldExist ? isset($attributes[$attname]) : ! isset($attributes[$attname])) {
+ $result[] = $grp;
+ }
+ }
+ return $result;
+}
+
function wikiplugin_group($data, $params)
{
// TODO : Re-implement friend filter
@@ -97,30 +111,15 @@ function wikiplugin_group($data, $params)
$notgroups = $params['notgroups'];
$allowedUsers = $params['users'];
$userPending = [];
+ $userNotPending = [];
if (! is_null($params['pending']) || ! is_null($params['notpending'])) {
+ $pending = $params['pending'] ?? [];
+ $notpending = $params['notpending'] ?? [];
$attributelib = TikiLib::lib('attribute');
$attributes = $attributelib->get_attributes('user', $user);
- $userlib = TikiLib::lib('user');
- if (! is_null($params['pending'])) {
- $pending = $params['pending'];
- foreach ($pending as $pgrp) {
- $grpinfo = $userlib->get_group_info($pgrp);
- $attname = 'tiki.memberextend.' . ($grpinfo['id'] ?? '');
- if (isset($attributes[$attname])) {
- $userPending[] = $pgrp;
- }
- }
- }
- if (! is_null($params['notpending'])) {
- $notpending = $params['notpending'];
- foreach ($notpending as $npgrp) {
- $grpinfo = $userlib->get_group_info($npgrp);
- $attname = 'tiki.memberextend.' . ($grpinfo['id'] ?? '');
- if (! isset($attributes[$attname])) {
- $userNotPending[] = $npgrp;
- }
- }
- }
+
+ $userPending = filterGroups($pending, true, $attributes);
+ $userNotPending = filterGroups($notpending, false, $attributes);
}
if (is_null($groups) && is_null($notgroups) && empty($pending) && empty($notpending) && is_null($allowedUsers)) {
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f51d16e7ebd6b5c76822df4a12a80f12941c554b
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f51d16e7ebd6b5c76822df4a12a80f12941c554b
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs