We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53276
    • 9 Posts
    Hello!
    I have a problem with FileDownLoadR.
    [[!FileDownload? 
    	&getFile=`assets/downloads/file.zip` 
    	&plugins=`
    		{
            "name":"redirect"
            ,"event":"BeforeFileDownload"
    		}
        `
    	]]
    

    Snippet "redirect"
    <?php
    $url = $modx->makeUrl(3);
    $modx->sendRedirect($url);
    


    In modx logs i found this errors.
    [] (ERROR @ /path../core/components/filedownloadr/model/filedownloadr/filedownloadplugin.class.php : 53) PHP warning: include(plugins/filedownloadplugin.events.php): failed to open stream: No such file or directory
    [] (ERROR @ /path../core/components/filedownloadr/model/filedownloadr/filedownloadplugin.class.php : 53) PHP warning: include(): Failed opening 'plugins/filedownloadplugin.events.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php')


    In file filedownloadr/model/filedownloadplugin.class.php I found this code.
    public function preparePlugins() {
            $this->_allEvents = include $this->configs['basePath'] . 'plugins/filedownloadplugin.events.php';
            $jPlugins = json_decode($this->configs['plugins'], 1);
            if (empty($jPlugins))
                return;
    
            foreach ($jPlugins as $v) {
                $this->_appliedEvents[$v['event']][] = $v;
            }
            foreach ($this->_allEvents as $i => $event) {
                if (isset($this->_appliedEvents[$i]))
                    $this->_allEvents[$i] = $this->_appliedEvents[$i];
            }
        }
    

    Vars $this->configs['basePath'] and $this->configs['plugins'] is empty and plugins doesn`t work. Please help to resolve this problem.