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.

4
  • Why are you trying to redirect to the base URL before an extension is installed?
    – Lodder
    Aug 1, 2017 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 Aug 1, 2017 at 8:58
  • Is this check for your own plugin, or other plugins being installed on your site?
    – Lodder
    Aug 1, 2017 at 9:00
  • For the the other plugins Aug 1, 2017 at 9:02

1 Answer 1

-1

Try removing this line;

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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