The extended fields are just a just a JSON string in the 'extended' field of the modUserProfile object. If there are fields you don't want to use, it doesn't hurt to leave them there, though maybe you want to stop showing them in the Manager when you go to "Manage Users."
This (untested) should remove the extended field for a given user:
$fieldName='someField';
$userId = 12; // or whatever
$profile = $modx->getObject('modUserProfile', array('internalKey' => $userId));
if ($profile) {
$extended = $profile->get('extended');
if (isset($extended[$fieldName])) {
unset($extended[$fieldName]);
$profile->set('extended', $extended);
$profile->save();
}
}
To remove the field for all users, it would look like this:
$fieldName='someField';
$profiles = $modx->getCollection('modUserProfile');
foreach ($profiles as $profile) {
$extended = $profile->get('extended');
if (isset($extended[$fieldName])) {
unset($extended[$fieldName]);
$profile->set('extended', $extended);
$profile->save();
}
}
If you want to remove *all* extended fields, you can do this in the code above:
foreach ($profiles as $profile) {
$profile->set('extended', array());
$profile->save();
}