[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [BP][FIX] Display all user groups in usergroup tracker module

"Baraka Kinywa \(@bkinywa24\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <688b25caabff5_2c10839a499659@gitlab-sidekiq-low-urgency-cpu-bound-v2-78fc7d7b7-bxm5b.mail>

Baraka Kinywa pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
960b4000 by MAGENE Sem Joel at 2025-07-31T11:06:37+03:00
[BP][FIX] Display all user groups in usergroup tracker module
---
* [BP][FIX] Display all user groups in usergroup tracker module
---
* [FIX] Display all user groups in usergroup tracker module
---
* [FIX] Display all user groups in usergroup tracker module

See merge request tikiwiki/tiki!7866

(cherry picked from commit 86a6968b6e8d44415ed312de702cb26631056853)

See merge request tikiwiki/tiki!8135

(cherry picked from commit 3bb04d5036d7f0966539d2fe59c7e62472d38492)

See merge request tikiwiki/tiki!8141

- - - - -


2 changed files:

- modules/mod-func-usergroup_tracker.php
- templates/modules/mod-usergroup_tracker.tpl


Changes:

=====================================
modules/mod-func-usergroup_tracker.php
=====================================
@@ -22,4 +22,20 @@ function module_usergroup_tracker_info()
  */
 function module_usergroup_tracker($mod_reference, $module_params)
 {
+    global $user, $smarty, $userlib;
+
+    if (! $user) {
+        return;
+    }
+
+    // Filter out system groups that cannot have tracker representations
+    $user_groups = array_filter(
+        $userlib->get_user_groups($user),
+        function ($group) {
+            return ! in_array($group, ['Anonymous']);
+        }
+    );
+
+    // Re-index array after filtering for clean template iteration
+    $smarty->assign('user_groups', array_values($user_groups));
 }


=====================================
templates/modules/mod-usergroup_tracker.tpl
=====================================
@@ -15,7 +15,13 @@
 {if $prefs.groupTracker eq 'y'}
 <div>{tr}Group information:{/tr}</div>
 <div class="card-body">
-&nbsp;&nbsp;<a href="tiki-view_tracker_item.php?view=+group" class="linkmodule">{$default_group|escape}</a>
+{if $user_groups && count($user_groups) > 0}
+    {foreach from=$user_groups item=group}
+        &nbsp;&nbsp;<a href="tiki-view_tracker_item.php?view=+group&group={$group|escape}" class="linkmodule">{$group|escape}</a><br>
+    {/foreach}
+{else}
+    &nbsp;&nbsp;<span class="text-muted">{tr}No groups available{/tr}</span>
+{/if}
 </div>
 {/if}
 



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/960b4000d574f81b9da2ee31cd1936e423556211

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/960b4000d574f81b9da2ee31cd1936e423556211
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.