# Plugin support for creating groups

**URL:** https://meta.discourse.org/t/plugin-support-for-creating-groups/60285
**Category:** Support
**Created:** [April 1, 2017, 4:10pm UTC](https://meta.discourse.org/t/plugin-support-for-creating-groups/60285 "2017-04-01T16:10:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![wichall](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@wichall](https://meta.discourse.org/u/wichall)
#### Post date: [April 1, 2017, 4:10pm UTC](https://meta.discourse.org/t/plugin-support-for-creating-groups/60285/1 "2017-04-01T16:10:00Z")

</div>

Hello, I’m totally new to discourse and have tried to get myself stuck in to making a plugin straight away.

Starting to work my around, but can anyone tell me what the best method would be for creating a new group within my plugin?

The end goal is to automatically add invitees to groups, created for each individual inviter.

Would it be best to directly call the GroupsController class or do some sort of post via the js?

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [April 1, 2017, 4:12pm UTC](https://meta.discourse.org/t/plugin-support-for-creating-groups/60285/2 "2017-04-01T16:12:40Z")

</div>

> [@wichall](#):
>
> goal is to automatically add invitees to groups

This feature already available while sending invitations.

---

<div class="post-metadata">

### Author: ![wichall](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@wichall](https://meta.discourse.org/u/wichall)
#### Post date: [April 1, 2017, 4:15pm UTC](https://meta.discourse.org/t/plugin-support-for-creating-groups/60285/3 "2017-04-01T16:15:11Z")

</div>

Thanks for the fast reply!

Yes it is, but only to existing groups.

I want invitees to automatically be added to a **newly created** group referencing the **inviter** (if it’s the inviter’s first invite).

I want this to be automatic, non-optional, separate from the existing _optional_ functionality.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [April 1, 2017, 4:26pm UTC](https://meta.discourse.org/t/plugin-support-for-creating-groups/60285/4 "2017-04-01T16:26:13Z")

</div>

You can call GroupsController methods directly from your plugin. Else you can copy codes from `save_group` method from [discourse/app/controllers/admin/groups\_controller.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/app/controllers/admin/groups_controller.rb#L51).

> [@wichall](#):
>
> some sort of post via the js?

It (Discourse API) will be useful if your creating group from another separate application.

---

<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: [October 4, 2022, 5:13am UTC](https://meta.discourse.org/t/plugin-support-for-creating-groups/60285/7 "2022-10-04T05:13:24Z")

</div>


