# Simple Role Creation Input Form?

**URL:** <https://community.gravityforms.com/t/simple-role-creation-input-form/12891>\
**Category:** Get Help\
**Tags:** role, gform\_after\_submission\
**Created:** [June 22, 2022, 3:15pm UTC](https://community.gravityforms.com/t/simple-role-creation-input-form/12891 "2022-06-22T15:15:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Perchpole](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/perchpole/32/1403_2.png) [@Perchpole](https://community.gravityforms.com/u/Perchpole)\
**Post date:** [June 22, 2022, 3:15pm UTC](https://community.gravityforms.com/t/simple-role-creation-input-form/12891/1 "2022-06-22T15:15:16Z")

</div>

Hello

Would it be possible to create a very basic user role creation form using GF? It may seem an odd way to go about things but there is method to my madness! I’ve created a number of forms for my client to control various admin tasks and I am keen to continue the trend.

The idea would be to give the client a means to add a new user role with the same set of predefined capabilities every time. The user would simply add a name for the new role, hit “submit” and the role would be created.

Do-able?

Many thanks,

Antar

---

<div class="post-metadata">

**Author:** ![sacom](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/sacom/32/53_2.png) [@sacom](https://community.gravityforms.com/u/sacom)\
**Post date:** [June 22, 2022, 3:42pm UTC](https://community.gravityforms.com/t/simple-role-creation-input-form/12891/2 "2022-06-22T15:42:10Z")

</div>

As you may know this is not a built-in feature, but you can use the following hook which gives you access to all the data submitted in $entry and WordPress core functions to run your own custom snippet for the role creation after the form submission: [gform\_after\_submission - Gravity Forms Documentation](https://docs.gravityforms.com/gform_after_submission/)

---

<div class="post-metadata">

**Author:** ![Perchpole](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/perchpole/32/1403_2.png) [@Perchpole](https://community.gravityforms.com/u/Perchpole)\
**Post date:** [June 22, 2022, 6:00pm UTC](https://community.gravityforms.com/t/simple-role-creation-input-form/12891/3 "2022-06-22T18:00:45Z")

</div>

Hi, Samuel -

Thank you for the tip. This is the snippet I use to create a User Role:

```auto
add_role('my_new_role', __(
   'My New Role'),
   array(
       'read' => true, 
       'create_posts' => false,
       'edit_posts' => false,
       )
);

```

How would I best combine this with the code you suggested? I would just need to change the name every time. Can you help me pull the pieces together please?

Thanks,

Antar

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [July 22, 2022, 6:01pm UTC](https://community.gravityforms.com/t/simple-role-creation-input-form/12891/4 "2022-07-22T18:01:35Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
