1

i've created an extension plugin and i'am having issue to redirect on the trigger onExtensionBeforeInstall

Here is my code :

class plgExtensionExample extends JPlugin{

    function onExtensionBeforeInstall($method, $type, $manifest, $eid){
        $app = JFactory::getApplication();
        $app->redirect(JRoute::_('index.php'));
        $app->close();
    }
}

When i try to install a plugin a have a javascript error :

In chrome

Uncaught TypeError: Cannot read property 'redirect' of undefined

In firefox

TypeError: res.data is undefined

I've searched in joomla and res is the result of a call in ajax, but res need to be an object and it's a string of html. I've tried to reach the url which is called in ajax but i got this message :

The most recent request was denied because it contained an invalid security token. Please refresh the page and try again.

Thanks for your answers.

  • Why are you trying to redirect to the base URL before an extension is installed? – Lodder Aug 1 '17 at 8:50
  • I want to do a check before installing a plugin, and in some cases i don't want to install the plugin – remi leclercq Aug 1 '17 at 8:58
  • Is this check for your own plugin, or other plugins being installed on your site? – Lodder Aug 1 '17 at 9:00
  • For the the other plugins – remi leclercq Aug 1 '17 at 9:02
-1

Try removing this line;

$app->close();
  • I've already tried and I got the same error. It's the same when I try to exit or die() – remi leclercq Aug 2 '17 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.