Logout action direct from Navbar Link

I would like to have a Logout link directly on a Navbar that is loaded as an php include file.

I have read the Security documents including creating a Logout button - which works fine when I have this as a normal button on a page.

I am confused as to the best method if I want the logout to happen from the Navbar menu link.

Create your logout action in Server Connect panel (security provider, logout, save). Add to your page with no load selected and ticked, maybe add a browser redirect at this point to redirect to the login page or whichever page you wish to redirect the user. Add an onlick mouse dynamic event to fire the action. Jobs-a-good-un. :slight_smile:

Almost there…

I am working on the include page. The Logout action is working OK but I can’t get the re-direct to the login page (index.php) to work.

For my Logout Navbar link I have a dynamic event for click that fires the logout server action.

On the same click event I have a browser.goto that redirects to ‘index.php’ - this part is not working as the browser just displays the original page. If I do a browser refresh then I get redirected to the login page via the security actions.

Is the browser js included in the page and uploaded to the host? Stupid question I know, sorry for asking.

Yes working now - the browser js was part of the include file and therefore was present.

If I remove the SSI include and then re-add it is working OK. Can’t see where the issue was, but give that it is working then I’m happy.

Thanks again for your help.

1 Like