# Any way to programmatically add to groups?

**URL:** https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474
**Category:** Support
**Tags:** groups
**Created:** [8월 24, 2015, 5:56오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474 "2015-08-24T17:56:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [8월 24, 2015, 5:56오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/1 "2015-08-24T17:56:35Z")

</div>

**I’d like to have several groups that are automatically populated with accounts older than N days.** The idea being that as user accounts age, new categories would open up to them based on the age of their account.

I can figure out how to do this with badges, but I can’t grant access to categories based on badges.

Is there any way to do what I described above?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [8월 24, 2015, 6:36오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/2 "2015-08-24T18:36:54Z")

</div>

There is some [discussion](https://meta.discourse.org/t/default-custom-group/31890/13) about it, but the [feature](https://meta.discourse.org/t/group-assignment-sql-query/25610) ins’t on core roadmap.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [8월 24, 2015, 11:13오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/3 "2015-08-24T23:13:53Z")

</div>

Hmm, why not just use the existing trust levels to do this?

Otherwise you’d have categories open up to people who created an account 45 days ago but did _nothing_.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [8월 24, 2015, 11:15오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/4 "2015-08-24T23:15:43Z")

</div>

Trust levels is close, but it’s limited to the pre-defined few groups. In my specific use case, I’d need more … basically the idea is creating cohorts based on join date.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [8월 24, 2015, 11:23오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/5 "2015-08-24T23:23:27Z")

</div>

I suggest a small app that moves users into groups using the Discourse API based on account age. Then the categories can key on the groups as they do.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [8월 24, 2015, 11:25오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/6 "2015-08-24T23:25:18Z")

</div>

Yes, that’s Plan B, but possibly with LDAP groups…

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [8월 25, 2015, 4:21오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/7 "2015-08-25T16:21:53Z")

</div>

I my use case I would create groups based on employee data, like branch id and position.

Better handle this through API then.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [6월 8, 2024, 12:45오후 UTC](https://meta.discourse.org/t/any-way-to-programmatically-add-to-groups/32474/9 "2024-06-08T12:45:12Z")

</div>

이 주제는 3210일 후 자동으로 닫혔습니다. 더 이상 답변을 할 수 없습니다.
