Title: Update user meta after submit Post Type
Last modified: August 30, 2016

---

# Update user meta after submit Post Type

 *  Resolved [bkseen](https://wordpress.org/support/users/bkseen/)
 * (@bkseen)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/)
 * Hi there,
 * I’ve read lot of forum but I didn’t find the solution to my problem.
 * I have a form with a “Save As Post Type” : When this one is submitted it create
   my object “Team”.
 * I would like to have get the ID of this created team to add that one to the user(
   as a meta-data) with user registration. If the user register his team it’s the
   normal way is he had to be a part of this one, but nowadays I have to do that
   manually.
    I read a bit about a command after the submit of the form but I didn’t
   really understand how to get the id of my object. I Tried a bit with the User
   Registration to create a Meta-Data but didn’t work.
 * Thanks in advance for the help, feel free to ask more details!
 * Cheers
 * [https://wordpress.org/plugins/gravity-forms-custom-post-types/](https://wordpress.org/plugins/gravity-forms-custom-post-types/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [bkseen](https://wordpress.org/support/users/bkseen/)
 * (@bkseen)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/#post-6729442)
 * Up.. no one to answer around here? I think my question is not so hard 🙂
 * Cheers
 *  Plugin Author [Dave from Gravity Wiz](https://wordpress.org/support/users/spivurno/)
 * (@spivurno)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/#post-6729500)
 * Hi bkseen, something like this in your functions.php should do the trick. Update“
   my_custom_key” to whatever you want the meta key to be.
 *     ```
       add_action( 'gform_user_registered', function( $user_id, $feed, $entry ) {
       	add_user_meta( $user_id, 'my_custom_key', $entry['post_id'] );
       }, 10, 3 );
       ```
   
 *  Thread Starter [bkseen](https://wordpress.org/support/users/bkseen/)
 * (@bkseen)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/#post-6729514)
 * Hi David, I tried you solution..and it doesn’t work.
 * I’ve replaced “my_custom_key” by the meta added with Custom Field, that my team_id.
 * my code at the total end of functions.php :
 *     ```
       add_action( 'gform_user_registered', function( $user_id, $feed, $entry ) {
       	add_user_meta( $user_id, 'team_id', $entry['post_id'] );
       }, 10, 3 );
       ```
   
 * I tried to replace post_id by ’18’ (my post ID) but nothing happen.
 * By the way I’ve seen something like that: [ here ](https://www.gravityhelp.com/documentation/article/gform_after_submission/),
   is it not the solution?
 * Please help me, it’s profesionnal and really important!
 * Cheers,
 * bkseen
 *  Thread Starter [bkseen](https://wordpress.org/support/users/bkseen/)
 * (@bkseen)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/#post-6729515)
 * I don’t know if it helps, but the type of my Custom Field is a : Post Object
 *  Plugin Author [Dave from Gravity Wiz](https://wordpress.org/support/users/spivurno/)
 * (@spivurno)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/#post-6729516)
 * Hi bkseen, if that doesn’t work, you’ll want to contact Gravity Forms support.
   The example was pulled from their documentation (I did change the function from
   update_user_meta to add_user_meta):
 * [https://www.gravityhelp.com/documentation/article/gform_user_registered/#examples](https://www.gravityhelp.com/documentation/article/gform_user_registered/#examples)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Update user meta after submit Post Type’ is closed to new replies.

 * ![](https://ps.w.org/gravity-forms-custom-post-types/assets/icon-256x256.png?
   rev=2542252)
 * [Gravity Forms + Custom Post Types](https://wordpress.org/plugins/gravity-forms-custom-post-types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-custom-post-types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-custom-post-types/reviews/)

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [form](https://wordpress.org/support/topic-tag/form/)
 * [gravity](https://wordpress.org/support/topic-tag/gravity/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 5 replies
 * 2 participants
 * Last reply from: [Dave from Gravity Wiz](https://wordpress.org/support/users/spivurno/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/update-user-meta-after-submit-post-type/#post-6729516)
 * Status: resolved