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.
Hi, thank you for developing this super useful plugin!
I’m currently using Discourse Dynamic Groups to automatically add all non-anonymous users to a special group. My boolean expression is:
NOT anonymous_users
Expected behavior:
When a new user registers (who does not belong to the anonymous_users group), they should be automatically added to this group, without any manual intervention.
Actual behavior:
Newly registered users are not immediately added to the group. They only get added after I manually re-save the boolean expression in the group settings.
This means the group is not updated automatically as users join, unless I trigger a manual sync.
I get the error: Unknown keyword, group or badge: 'anonymous_users'
If I change the group name to my actual group, for example:
trust_level_0 AND NOT interns
I still get: Unknown keyword, group or badge: 'interns'
I have double-checked and I am copying the group’s unique name directly from the group admin page, so there are no typos.
Is there anything I might be missing, or is there something else I need to configure for custom groups to be recognized in the expression?
While trying to reproduce, I have identified two bugs and one of them probably hit you.
Can you please update the plugin to the latest version 59640f1 and see if that resolves the issue.
The plugin still does not deal with renaming groups very well. If you rename a group you should save the rules from all groups that depend on it (just enter a space after the boolean expression and remove it again to enable the Save button). This will be addressed in a later version.