• Resolved DestinyKing

    (@destinyking)


    I have been trying to get this coding snippet up and running and have hit a wall. Any suggestions will be appreciated!

    function wpf_dev_process_complete( $fields, $entry, $form_data, $entry_id ) {
        
        $form_id = 2819; // Change form ID
        $user_id = get_current_user_id();
        // Optional, you can limit to specific forms. Below, we restrict output to
        if ( absint( $form_data['id'] ) !== 2819 ) {
            return;
        }
        
        // Update user object with new field values
        $updated_values = array(
    		'ID'($user_id),
    		'user_email'($fields[5]['value']),
    		'test'($fields [4] ['value'])
        );
    
        // Update user
    	update_user_meta($updated_values);
    
        // get all the meta data of the user
        $user_data = get_user_meta($user_id, 'test');
    
        
    }

    I have added the form id accordingly. This is a test form so I have two total fields and email one (field id #5) and a text field called Test (field id #4).

    I am using Advanced Custom Fields to add a custom text field called Test.

    Right now I want it to pull up the logged-in user ID which is what it is doing but when the user submits the form it does not show a confirmation update saying the default “Thanks for contacting us! We will be in touch with you shortly.”

    It also does not update the meta field ‘test’ on the user profile. Any suggestions would be GREATLY appreciated!

    The overall goal is to allow the logged-in user to update a form that will then update their unique profile fields with Advance Custom Fields.

    • This topic was modified 2 years, 3 months ago by DestinyKing.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Update User Meta Fields’ is closed to new replies.