When creating a group, we have the automatic membership setting based on a user’s email domain name. I would like to have this functionality based on the value of a custom field.
Example Use Case
I have a condo community with a dropdown custom field signifying ownership status (Owner, Renter). I want to have all owners automatically in an owner group and to be able to message only all owners for certain messages.
Caveats
This sounds straight forward for dropdown and confirmation custom fields, but I guess could get hairy for text fields. It would be fine to enable it only for dropdowns and confirmations, otherwise exact text match is fine for text fields.
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.
앞으로 이 글을 보게 될 분들을 위해 공유합니다. 저도 비슷한 사용 사례(서비스를 제공하는 사람 vs. 서비스를 찾는 사람)를 가지고 있었는데, 결국 웹훅과 Discourse API를 통해 구현했습니다.
구체적으로, 저는…
사용자 이벤트 발생 시 트리거되는 웹훅을 생성했습니다.
페이로드를 수신하기 위한 최소한의 Express.js 서버를 구현했습니다.
user_created 이벤트에 대한 POST 라우트를 설정하여 사용자 정의 사용자 필드의 값을 확인한 후, Discourse API를 사용하여 사용자의 그룹을 그에 맞게 설정하도록 했습니다.
Discourse 외부에서 Discourse 내부의 요소를 수정하는 방식이라 다소 어색하게 느껴질 수 있지만, 포럼을 뒤져봐도 이에 대한 답을 찾지 못해 최선의 노력을 다했습니다. 이 글이 앞으로 누군가에게 도움이 되길 바라며, 더 나은 방법이 있다면 알려주시면 좋겠습니다.
@li-zi 님, 이미 해당 사례에 대해 해결하신 것 같지만, 또 다른 잠재적인 해결책은 Custom Wizard 플러그인을 사용하는 것입니다.
저는 이 플러그인을 사용하여 신규 사용자가 가입한 후 마법사(wizard)를 통해 정보를 입력하도록 유도합니다.
마법사에는 드롭다운 옵션을 제공하는 필드가 몇 가지 있습니다.
그런 다음 마법사가 제출된 후 완료할 두 가지 별도의 작업을 설정합니다: