Support

Account

Home Forums Front-end Issues Trying to submit value to profile custom field

Solved

Trying to submit value to profile custom field

  • I have a custom registration form and when trying to submit a value to the ACF field, I cant seem to get it to work. I have tried the below with no luck, any advice on how I set a value the value to be the same as the current user?:

    global $wpdb;
    $currentUser = wp_get_current_user();
    $territory = get_field('field_5d936a7fc6621', $currentUser);

    $userdata = array(
    ‘user_login’ => $email,
    ‘user_email’ => $email,
    ‘role’ => ‘customer-dealer’,
    ‘Territory’ => $territory,
    ‘user_pass’ => NULL

    );
    $user_id = wp_insert_user( $userdata ) ;

    echo “User Created Successfully”;
    exit();
    }`

    I have also tried 'field_5d936a7fc6621' => $territory,

    Any help appreciated.

  • getting a field from a user

    
    $territory = get_field('field_5d936a7fc6621', 'user_'.$user_id);
    

    updating a user field

    
    update_field($field_key, $value, 'user_'.$user_id);
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Trying to submit value to profile custom field’ is closed to new replies.