I am wrestling with a bizarre problem in the MODx manager. I am developing a plugin, and suddenly the selected events are unchecked after I save the plugin. I go in and reselect the events, save the plugin, look at the event list again, and all my selected events are unchecked. What is causing this??
I found the cause of the problem, but I’m not sure of the best solution. In the file save_plugin.processor.php, function saveEventListeners, the variable $priority was making it through the logic without being set. This results in a SQL statement like:
INSERT INTO `ettc`.`modx_site_plugin_events` (pluginid,evtid,priority) VALUES (’10’,’2’,’’)
The resulting empty string set in the priority column causes the database to reject this statement. Thus, all the events are deleted (by a prior SQL statement), but none are created. I fixed my installation by checking if $priority is empty, and setting it to 0 if it is. I don’t know what ramifications this will have, but it got me past this hump.