Simple Role Creation Input Form?

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

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

Hi, Samuel -

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

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