קבוצות דינמיות בדיסקורז

:information_source: Summary Automatically manage group membership
:hammer_and_wrench: Repository Link https://github.com/communiteq/discourse-dynamic-groups
:open_book: Install Guide How to install plugins in Discourse

:warning: This plugin should be considered beta :warning:

Features

Discourse communities often need to automate group memberships based on conditions like badge ownership or existing group memberships.

Common use cases include:

  • Users not in the ‘subscribers’ group

  • Users not banned from posting in Marketplace

  • Users at TL0 or TL1, but not TL2

  • Users who have completed the new user tutorial or have been members for over a year

  • Users belonging to client_1, client_2, or client_3 and are not an intern

Previously, solving this required custom scripts that periodically synchronized groups. The Dynamic Groups plugin eliminates that need.

This plugin introduces a boolean expression field to group settings, allowing administrators to define rules that dynamically determine group membership.

Examples:

  • users who are not in the ‘subscribers’ group
    trust_level_0 AND NOT subscribers

  • users who are not banned from posting in Marketplace
    trust_level_2 AND NOT banned_users

  • users who are on TL0 or TL1 but not on TL2
    trust_level_0 AND NOT trust_level_2

  • users who completed the new user tutorial or are member for over a year
    badge:certified OR badge:anniversary

  • users who belong to client 1, 2 or 3 and are not an intern
    (client_1 OR client_2 OR client_3) AND NOT interns

Configuration

Once the plugin is installed and enabled, a new tab will appear in the group admin interface:

When you enter or update the boolean expression, the system will take a few moments to populate the group with matching users. From that point on, group membership will be automatically updated as user status changes.

Important:
When a rule is defined, the group is marked as automatic, disabling manual member changes. To revert the group to manual management, simply clear the expression field. The existing members will remain, and you’ll regain manual control.

24 לייקים

Wow! Awesome work, Richard!

This fills a large gap in group management within Discourse. Totally delighted, and looking forward to giving it a good run.

I’ll be primarily using it to enable functional subgroups.

3 לייקים

Definitely a welcome addition to Discourse’s features!

לייק 1

7 הודעות שולבו לנושא קיים: הפעלת שדה Multiselect בפעם הראשונה שנכנס המשתמש

היי, תודה שפיתחת את התוסף הסופר-שימושי הזה!

אני משתמש כרגע ב-Discourse Dynamic Groups כדי להוסיף אוטומטית את כל המשתמשים הלא-אנונימיים לקבוצה מיוחדת. הביטוי הבוליאני שלי הוא:

NOT anonymous_users
התנהגות מצופה:
כשמשתמש חדש נרשם (שאינו שייך לקבוצת anonymous_users), הוא אמור להתווסף אוטומטית לקבוצה זו, ללא התערבות ידנית.

התנהגות בפועל:
משתמשים חדשים שנרשמים אינם מתווספים מיד לקבוצה. הם מתווספים רק לאחר שאני שומר מחדש באופן ידני את הביטוי הבוליאני בהגדרות הקבוצה.
זה אומר שהקבוצה לא מתעדכנת אוטומטית ככל שמשתמשים מצטרפים, אלא אם כן אני מפעיל סנכרון ידני.

לייק 1

הממ… תפיסה טובה. ואני מסכים שזו צריכה להיות ההתנהגות הצפויה.

מנקודת מבט טכנית, הפלאגין יעריך מחדש את חברות הקבוצה רק בשני תנאים שונים:

  1. כאשר הביטוי הבוליאני בהגדרות הקבוצה נשמר
  2. אם משתמש נוסף או מוסר מקבוצה המוזכרת בביטוי הבוליאני.

כאשר משתמש חדש נרשם, אף אחד מהמקרים אינו מתקיים.

האם תוכל לנסות לשנות את הביטוי ל- trust_level_0 AND NOT anonymous_users ולדווח אם זה פותר את הבעיה?

3 לייקים

שלום,

כשאני מנסה להשתמש בביטוי

trust_level_0 AND NOT anonymous_users

אני מקבל את השגיאה:
Unknown keyword, group or badge: 'anonymous_users'

אם אני משנה את שם הקבוצה לקבוצה האמיתית שלי, לדוגמה:

trust_level_0 AND NOT interns

אני עדיין מקבל:
Unknown keyword, group or badge: 'interns'

בדקתי שוב ואני מעתיק את השם הייחודי של הקבוצה ישירות מדף ניהול הקבוצה, כך שאין שגיאות הקלדה.
האם יש משהו שאולי אני מפספס, או שיש משהו אחר שאני צריך להגדיר כדי שקבוצות מותאמות אישית יזוהו בביטוי?

4 לייקים

תודה שדיווחת על כך.

בזמן שניסיתי לשחזר, זיהיתי שני באגים ואחד מהם כנראה פגע בך.
האם תוכל בבקשה לעדכן את הפלאגין לגרסה האחרונה 59640f1 ולבדוק אם זה פותר את הבעיה.

הפלאגין עדיין לא מתמודד טוב במיוחד עם שינוי שמות של קבוצות. אם אתה משנה שם של קבוצה, עליך לשמור את הכללים מכל הקבוצות שתלויות בה (פשוט הכנס רווח אחרי הביטוי הבוליאני והסר אותו שוב כדי להפעיל את כפתור השמירה). זה יטופל בגרסה מאוחרת יותר.

3 לייקים

Is this using your Category restrictor plugin or thi functions independently from it?

awesome plugin to fill in gaps.

It functions independently.

לייק 1

שלום,

אני משתמש בתוסף Dynamic Groups והגדרתי את הקריטריונים שלי כך:

trust_level_0 AND NOT anon_group

עם זאת, שמתי לב שגם משתמשים עם trust_level_1 שאינם ב-anon_group מתווספים לקבוצה הדינמית הזו.

האם תוכלו לאשר אם זה ההתנהגות הצפויה, או שזהו באג?

Users with trust level 1 are also members of the trust level 0 group. So the behavior is expected. You could exclude the trust level 1 group to only get TL0 users. Similar to the example from the first post

2 לייקים

תודה על ההבהרה