I had a pretty sweet plugin working in version 2.1.3 and earlier. It would pre-set the template for new resources based on certain conditions. It looked basically like this:
if ($mode == 'new') {
$parentID = (int) $_REQUEST['parent'];
if ($parent = $modx->getObject('modResource', $parentID)) {
if ($tpl = $modx->runSnippet('someSnippetThatMightReturnATemplateID', array('parentID'=>$parentID))) {
$_REQUEST['template'] = $tpl;
}
}
}
When the inner snippet returned a template number, the new resource would automagically load that template because "&template=28" (or whatever template ID number it happens to be) was automagically appended to the query string.
Combined with template-based FC rules, this was an important part of my master plan for taking over the world.
This worked in 2.1.3 either on the "OnDocFormPrerender" OR the "OnDocFormRender" events.
It doesn't seem to work at all in 2.2.0-pl2, and it is RUINING MY LIFE.
Have the behaviors of these system events changed? Or the way MODX deals with the REQUEST array? Or how it writes the query string?
I will cry myself to sleep if I can't get this plugin working.