Has no one else noticed this? https://github.com/modxcms/fred/issues/390
Adding this to the end of the core/components/fred/processors/mgr/elements/create.class.php solves the problem.
public function afterSave()
{
$templates = $this->getProperty('templates');
$templates = array_map('intval', $templates);
$templates = array_filter($templates);
foreach ($templates as $template) {
$categoryTemplate = $this->modx->newObject('FredElementTemplateAccess');
$categoryTemplate->set('element', $this->object->id);
$categoryTemplate->set('template', $template);
$categoryTemplate->save();
}
return parent::afterSave();
}
Well, that was interesting. That may fix the problem of saving the templates on first save, but it completely broke Fred. Thanks to the MODX Cloud people for such efficient backups!