Title: User update after form submit
Last modified: August 25, 2021

---

# User update after form submit

 *  [Christoph Jaenisch](https://wordpress.org/support/users/campaz/)
 * (@campaz)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/user-update-after-form-submit/)
 * Hi,
 * I try to update the user when he submits a form. But for some reason, it just
   won’t work with the action hook.
    I tried my code standalone, and it works. But
   within the hook “wpcf7_before_send_mail”, the field will not be updated.
 *     ```
       add_action( 'wpcf7_before_send_mail', array( $this, 'update_customer_after_form_submit') );
   
       function update_customer_after_form_submit( $contact_data ){
       	$id = $contact_data->id();
       	if( $id === 55024 )	{
       		// set customer meta
       		$user_id = get_current_user_id();
       		if( $user_id != 0 )	{
       			update_user_meta( $user_id, 'b2b_company_registration', 1 );
       		}
       	}
       }
       ```
   
 * Any help appreciated!
    Best regards, Christoph

The topic ‘User update after form submit’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Christoph Jaenisch](https://wordpress.org/support/users/campaz/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/user-update-after-form-submit/)
 * Status: not resolved