Just thought I’d share my little modification to this plugin. I found that when creating a new document and before selecting a template, the HideEditor plugin would fail and throw up an sql error.
The reason for this is that as TobyL pointed out in the thread for the ’Customise Manager Fields’ plugin (
http://modxcms.com/forums/index.php/topic,11203.msg81871.html#msg81871), the content[’template’] variable only gets set when the user makes a selection in the ’template’ drop-down menu in the document edit screen. So therefore when creating a new document the HideEditor plugin tries to run a query with a blank template id.
So to fix this I did something similar to TobyL’s ’Customise Manager Fields’ modification:
1. replace this line:
with these two lines:
global $content,$default_template;
$template_id = isset($content['template']) ? $content['template'] : $default_template;
2. Replace this line:
if (($e->name == 'OnDocFormRender') && ($content['template'] > 0)) {
with this line:
if (($e->name == 'OnDocFormRender') && $template_id > 0) {
3. And finally, replace this line:
if (($template = $modx->db->getValue("SELECT content FROM {$modx->db->config['table_prefix']}site_templates WHERE id = {$content['template']}")) !== false) {
with this one:
if (($template = $modx->db->getValue("SELECT content FROM {$modx->db->config['table_prefix']}site_templates WHERE id = $template_id")) !== false) {
Hopefully this’ll be helpful to anyone having the same issue I had.