1

I have a user plugin which performs some tasks and then logs the user out using $app->logout($userID, []);.

This is intentional and part of the plugin's functionality, and works well if no other plugins are installed.

However, it is causing problems as it interferes with other user plugins that are installed.

With the logout() call, Joomla clears the session, redirects to the site home page and exits the program. This happens immediately; the program flow does not return to the plugin that called logout().

This means that any other user plugins that are set to run after this one are not being run.

Is there a way to tell Joomla from within my plugin that I want to log the user out at the end of the current page load, rather than immediately as per the logout() method that we're using now?

Thank you.

1 Answer 1

3

The Joomla plugins run as they are ordered in the Joomla backend. Change the ordering - and ensure that the ordering of your plugin is last. This will ensure that all other plugins will run before yours.

1
  • Thanks for the reply. Yes, I did this already, and it's a work-around, but it doesn't solve the underlying problem. What happens if there are two plugins that both need to be last? What happens if the main program code does something else after the plugin events are triggered?
    – Simba
    Commented Apr 4, 2017 at 8:15

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.