How to Set up Login and Logout Links in Joomla

| Joomla
login and logout

One of our Pro members was browsing around OSTraining and saw that the menu link "Login" was automatically replaced by "Logout" once someone had logged in.

This task has become even easier, thanks to a new feature in Joomla 3.5.

In this tutorial, I'm going to show you how to create a Login menu item that only appears to users that aren't signed in. Once they sign in, they'll get a Logout menu item instead. 

Step #1. Create the Login link

First, let's create the Login.

  • Go to Menus > your menu > Add New Menu Item
How to Set up Login and Logout Links in Joomla
  • Enter a Menu Title.
  • Select the Menu Item Type.
  • Choose Users > Login Form.
  • Set "Access" to "Guest"
  • Click "Save & New".

Guest access will make it so that it only appears to non-logged-in users. If for some reason your site doesn't have Guest access, you can use this tutorial to create it.

Step #2. Create the Logout link

Next, let's create the Logout link.

  • Create a new menu item.
  • Enter a Menu Title.
  • Select the Menu Item Type.
  •  Choose Users > Logout.

This feature was added in Joomla 3.5. So if you don't have this option, you'd need to update to Joomla 3.5 or later.

  • Switch "Access" to "Registered".
  • Click "Save & Close".

Step #3. Test the links

Finally, let's test to make sure we got everything right.

Here are some things to check for:

  • Does the "Login" appear when logged out?
  • Does the "Logout" appear when logged in? Does it appear when logged in with another account of a different access level? If not, you may need to adjust the Access Control. We have a class on that at Joomla's Access Control Levels.

That's all there is to it. Congrats! Joomla 3.5 and higher makes it really easy to set up.


About the author

Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.