在创建群组时,我们支持基于用户电子邮件域名的自动成员资格设置。我希望能够基于自定义字段的值实现此功能。
示例用例
我有一个公寓社区,其中包含一个表示所有权状态(业主、租客)的下拉式自定义字段。我希望所有业主都能自动加入业主群组,并且能够仅向所有业主发送特定消息。
注意事项
对于下拉式和确认式自定义字段,这听起来很简单,但我猜对于文本字段可能会变得复杂。如果仅针对下拉式和确认式字段启用此功能也可以接受;否则,对于文本字段,精确文本匹配即可。
在创建群组时,我们支持基于用户电子邮件域名的自动成员资格设置。我希望能够基于自定义字段的值实现此功能。
我有一个公寓社区,其中包含一个表示所有权状态(业主、租客)的下拉式自定义字段。我希望所有业主都能自动加入业主群组,并且能够仅向所有业主发送特定消息。
对于下拉式和确认式自定义字段,这听起来很简单,但我猜对于文本字段可能会变得复杂。如果仅针对下拉式和确认式字段启用此功能也可以接受;否则,对于文本字段,精确文本匹配即可。
Since these are user settable custom fields, you can just make the groups open membership and tell people to add / remove themselves via the /groups page.
Not realistic for my use case. Hard to get a bunch of random homeowners, some very old, to bother going around tinkering with their settings. It was hard enough getting them to just register once to get the emails, and it’s hard to even get them to pay attention and do stuff even when there are financial penalties.
For anybody coming across this in the future: I had a similar use case (two distinct user populations – people offering services vs. people seeking services) and ended up implementing it via webhooks and the Discourse API.
More specifically, I…
user_created events that checks the value of a custom user field, and then uses the Discourse API to set the user’s group accordinglyThis seems like kind of a goofy way to do it because I’m going outside Discourse to modify something within Discourse, but I scoured the forum for answers to this and came up with nothing, so I did my best! Hope this helps someone in the future, and if anyone comes up with a better way of doing it, I’d love to know.
我想做一件与此非常相似的事情,即根据自定义用户字段下拉菜单自动将用户分组到不同组中。请问您是否已将此功能开源?
我的使用场景也基本相同,我之前在这里提过这个问题
@li-zi 我知道你已经为你的情况解决了这个问题,但在我看来,另一个潜在的解决方案是使用 Custom Wizard 插件。我使用它来提示新用户在注册后填写向导。该向导包含一些提供下拉选项的字段。然后,我设置了两个在向导提交后执行的操作:
为了结束这个话题——现在可以使用“通过自定义字段将用户添加到组”自动化脚本来实现这一点。 ![]()
您可以在此处阅读更多关于如何执行此操作的信息: