# How to add multiple user roles upon user creation

**URL:** <https://community.gravityforms.com/t/how-to-add-multiple-user-roles-upon-user-creation/541>\
**Category:** Get Help\
**Tags:** user-registration\
**Created:** [December 7, 2018, 1:05pm UTC](https://community.gravityforms.com/t/how-to-add-multiple-user-roles-upon-user-creation/541 "2018-12-07T13:05:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5b81f4e8f11d50.1](https://avatars.discourse-cdn.com/v4/letter/u/977dab/32.png) [@user5b81f4e8f11d50.1](https://community.gravityforms.com/u/user5b81f4e8f11d50.1)\
**Post date:** [December 7, 2018, 1:05pm UTC](https://community.gravityforms.com/t/how-to-add-multiple-user-roles-upon-user-creation/541/1 "2018-12-07T13:05:20Z")

</div>

Hi Everyone,

I’m a bit new to gravity forms and I am trying to do something that isn’t too obvious.

I want to be able to add multiple roles to one user upon creation. It looks like the user creation module only lets me chose one roll

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 7, 2018, 4:16pm UTC](https://community.gravityforms.com/t/how-to-add-multiple-user-roles-upon-user-creation/541/2 "2018-12-07T16:16:58Z")

</div>

You can use the [gform\_user\_registered](https://docs.gravityforms.com/gform_user_registered/) filter to ADD an additional role to the role you have configured in the User Registration feed.

The code would look like this to add an additional role:

```auto
add_action( 'gform_user_registered', 'add_another_role', 10, 3 );
function add_another_role( $user_id, $feed, $entry ) {
    // edited code example July 19, 2021 to add the next line
    $user = new WP_User( $user_id );
	// add another role to the registered user
	$user->add_role( 'super-dude' );
}

```

That code can go into your theme functions.php file or a functionality plugin.

> **[Where Do I Put This Code? - Gravity Forms Documentation](https://docs.gravityforms.com/where-do-i-put-this-code/#php)**
>
> In this article, we will show you where you should typically place code that is within our documentation.

---

<div class="post-metadata">

**Author:** ![user5b81f4e8f11d50.1](https://avatars.discourse-cdn.com/v4/letter/u/977dab/32.png) [@user5b81f4e8f11d50.1](https://community.gravityforms.com/u/user5b81f4e8f11d50.1)\
**Post date:** [December 7, 2018, 10:36pm UTC](https://community.gravityforms.com/t/how-to-add-multiple-user-roles-upon-user-creation/541/3 "2018-12-07T22:36:48Z")

</div>

awesome! I’ll give it a shot tonight and let you know how it worked.

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 4, 2022, 5:41pm UTC](https://community.gravityforms.com/t/how-to-add-multiple-user-roles-upon-user-creation/541/4 "2022-01-04T17:41:39Z")

</div>


