2

I am seeking a way to trigger a redirect on user logout.

One obvious way to do this seems liable to cause problems. The event of logout can be used to trigger a plugin using the event onUserLogout. It's then possible, in the plugin, to call $app->redirect("/some/url"); where $app is the current application object.

However, this has the potentially serious drawback that it seems to stop the processing of plugins that want to be called by onUserLogout. There may be other plugins that need to run. It also breaks any plugin that has called $app->logout().

Is there a way to cause a redirect on logout without this problem?

1
  • Welcome to JSE and thank you for posting. While you wait for support, please take our tour.
    – mickmackusa
    Apr 4 at 22:05
1

in theory i can follow you but have you experienced any issues regarding this? i mean - i‘ve never had such issues before. on the other hand you can also sort plugins. just an idea but you could „just“ order the plugins and try if this would work. otherwise i would recommend to build a scenario and open a bug report on github.

1
  • Yes, I spent hours diagnosing the problem. It's true the former issue can be fixed by sorting plugins, but the latter cannot. I had two plugins - one did the redirect, the other called logout but did not receive a return because of the first one and therefore broke. It is a question of usage, I'm not clear that it can be described as a bug.
    – mbrampton
    Apr 5 at 18: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.