Hello, i need some help from expierenced Modx users on my new project.
I want a site where manager can add user.
These users have their own extended fields (some images and a pdf file) and it will be a folder created. The one with the folder I already solved with discussion forums posts.
Plugin (OnUserFormSave)
if ($mode == modSystemEvent::MODE_UPD) {
//an eMail should go to the user
return true;
}
if ($mode == modSystemEvent::MODE_NEW) {
$userName = $user->get('username');
$userID = $user->get('id');
$dir = (boolean)$modx->getOption('filemanager_path_relative',null,false) ? $modx->getOption('base_path') : '';
$dir .= $modx->getOption('filemanager_path',null,'').'assets/kunden/'.$userID.' '.$userName;
$folder_permissions = octdec($modx->getOption('new_folder_permissions'));
if (!@mkdir($dir,$folder_permissions)) {
$modx->log(modX::LOG_LEVEL_ERROR,'Konnte ordner nicht erstellen: '.$dir);
}
// I dont know what but something is wrong here in the code
$profile = $user->getOne('Profile');
$extended = array();
$extended = $profile->get('extended');
$extended[] 'field1' => 'TestValue 1';
$extended[] 'field2' => 'Test Value 2';
$profile->set('extended', $extended);
$profile->save();
return true;
}
It works with the user folder but dont work with the extended fields.
In one of these extended fields schould be the new created path to the user folder.
The best way where if I create a new user that this user get an email notification with his login data.
If I update the User e.g. I put a PDF in the extended field called pdfpath the user will get an email notification about some updates on his profile.