diff --git a/CHANGES.md b/CHANGES.md
index 567185a5855e900490311d29db663cf17521b6c4..6a24f2e717d997338630ba327224154101776ed9 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Changes
 
 ### Unreleased
 
+* 2018-02-02 - Adopt code changes in Moodle 3.3 core auth_ldap: Sync user profile fields
 * 2018-02-02 - Adopt code changes in Moodle 3.3 core auth_ldap: Convert auth plugins to use settings.php. Please double-check your plugin settings after upgrading to this version.
 * 2017-12-12 - Prepare compatibility for Moodle 3.3, no functionality change.
 * 2017-12-05 - Added Workaround to travis.yml for fixing Behat tests with TravisCI.
diff --git a/auth.php b/auth.php
index 9bde324fe692cce3574560ef9ba640dae4e1e692..c8258948926a00dc2761039d538fe1f78dd82f6d 100644
--- a/auth.php
+++ b/auth.php
@@ -331,23 +331,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
         /// User Updates - time-consuming (optional)
         if ($do_updates) {
             // Narrow down what fields we need to update
-            $all_keys = array_keys(get_object_vars($this->config));
-            $updatekeys = array();
-            foreach ($all_keys as $key) {
-                if (preg_match('/^field_updatelocal_(.+)$/', $key, $match)) {
-                    // If we have a field to update it from
-                    // and it must be updated 'onlogin' we
-                    // update it on cron
-                    if (!empty($this->config->{'field_map_'.$match[1]})
-                         and $this->config->{$match[0]} === 'onlogin') {
-                        array_push($updatekeys, $match[1]); // the actual key name
-                    }
-                }
-            }
-            if ($this->config->suspended_attribute && $this->config->sync_suspended) {
-                $updatekeys[] = 'suspended';
-            }
-            unset($all_keys); unset($key);
+            $updatekeys = $this->get_profile_keys();
         } else {
             mtrace(get_string('noupdatestobedone', 'auth_ldap'));
         }
@@ -458,29 +442,8 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
                     }
 
                     // Save custom profile fields.
-                    $profilefields = array();
-                    foreach ($user as $key => $value) {
-                        if (preg_match('/^profile_field_(.*)$/', $key, $match)) {
-                            $field = $match[1];
-                            $profilefields[$field] = $user->$key;
-                        }
-                    }
-                    // Now, save the profile fields if the user has any.
-                    if ($fields = $DB->get_records('user_info_field')) {
-                        foreach ($fields as $field) {
-                            if (isset($profilefields[$field->shortname])) {
-                                $conditions = array('fieldid' => $field->id, 'userid' => $euser->id);
-                                $id = $DB->get_field('user_info_data', 'id', $conditions);
-                                $data = $profilefields[$field->shortname];
-                                if ($id) {
-                                    $DB->set_field('user_info_data', 'data', $data, array('id' => $id));
-                                } else {
-                                    $record = array('fieldid' => $field->id, 'userid' => $euser->id, 'data' => $data);
-                                    $DB->insert_record('user_info_data', $record);
-                                }
-                            }
-                        }
-                    }
+                    $updatekeys = $this->get_profile_keys(true);
+                    $this->update_user_record($user->username, $updatekeys, false);
                 }
                 $transaction->allow_commit();
                 unset($add_users); // free mem