How to implement a button logout on the head of web site?

I want to create a button logout which show when have user login and hide when user logout. This button will not show when no user login.

Hi, u can use {$sUserData} as logged in flag [code] {if $sUserData}

Logout
{else}
Login
{/if} [/code]

Thank you! Your answer is good but it still have a bug. When user stand on page account (login page) it will show logout but user not yet login, and it will show “login” on other page even user already login or not.

Hi, try {if $sUserLoggedIn}[Logout]({url controller='account' action='logout'}){else}[Login]({url controller='account'} "Anmelden oder ein Konto eröffnen"){/if}

1 „Gefällt mir“

Thank you! I had try your code but it have a bug. It always return false when i debug it and it always view the word „login“ even user login or not.

That Variable is online available inside checkput_actions! Place it there and do a position absolute to Place it on your Site. Cheers!

[quote=„ErikBrinx“]Hi, try {if $sUserLoggedIn}[Logout]({url controller='account' action='logout'}){else}[Login]({url controller='account'} "Anmelden oder ein Konto eröffnen"){/if} [/quote] Thanks, it works like charm. :thumbup:

Thank ErikBrinx, sengchheang and all very much. Now it work well.