Quote from: BobRay at Oct 24, 2013, 05:20 PMThere's no reason you couldn't save the email as an extended field in a plugin attached to OnDocFormSave, though I'm not sure why you'd want to do that since it's easily available in the User Profile.
what he has needed was not one email-field, but datas of multiple email-accounts per user.
We created a CMP with MIGXdb now where he can edit all extended fields and used a MIGX-TV-field to manage the mail-accounts per user.
No extended - modUser needed. All datas including the mail-accounts are stored into the extended field.
Created a custom-update-processor, which has this in it (relevant part of the code):
$extended = array();
foreach ($data as $key => $value) {
$field = explode('.', $key);
if (count($field) > 1) {
//extended field (json-array)
if ($field[0] == 'Profile_extended'){
$extended[$field[1]] = $value;
unset($data[$key]);
}
}
elseif(substr($key,0,8) == 'Profile_'){
$data[substr($key,8)] = $value;
unset($data[$key]);
}
}
//$extended['accounts'] = $data['Profile_extended.accounts'];
$data['extended'] = $extended;
//$data['email'] = $data['Profile_email'];
$response = $modx->runProcessor('security/user/update', $data);
$checkresponse = true;
Think this is a quick an clean solution and easyli extentable.
[ed. note: Bruno17 last edited this post 12 years, 11 months ago.]