• 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.