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

**URL:** https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328
**Category:** Shopware 3.5
**Tags:** themes--design
**Created:** [23. Mai 2013 um 11:20 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328 "2013-05-23T11:20:18Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/2/9/29c7587ba660f00e4995d1743162782e5d6d8653.svg) [@system](https://forum.shopware.com/u/system)
#### Post date: [23. Mai 2013 um 11:20 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/1 "2013-05-23T11:20:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kotoradeluxe](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@kotoradeluxe](https://forum.shopware.com/u/kotoradeluxe)
#### Post date: [23. Mai 2013 um 12:05 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/2 "2013-05-23T12:05:41Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/2/9/29c7587ba660f00e4995d1743162782e5d6d8653.svg) [@system](https://forum.shopware.com/u/system)
#### Post date: [23. Mai 2013 um 12:31 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/3 "2013-05-23T12:31:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ErikBrinx](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@ErikBrinx](https://forum.shopware.com/u/ErikBrinx)
#### Post date: [23. Mai 2013 um 12:38 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/4 "2013-05-23T12:38:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/2/9/29c7587ba660f00e4995d1743162782e5d6d8653.svg) [@system](https://forum.shopware.com/u/system)
#### Post date: [27. Mai 2013 um 12:31 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/5 "2013-05-27T12:31:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.shopware.com/u/Mark)
#### Post date: [27. Mai 2013 um 13:56 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/6 "2013-05-27T13:56:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Sengchheang](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Sengchheang](https://forum.shopware.com/u/Sengchheang)
#### Post date: [6. Juni 2013 um 17:55 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/7 "2013-06-06T17:55:24Z")

</div>

[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:

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/2/9/29c7587ba660f00e4995d1743162782e5d6d8653.svg) [@system](https://forum.shopware.com/u/system)
#### Post date: [7. Juni 2013 um 03:35 UTC](https://forum.shopware.com/t/how-to-implement-a-button-logout-on-the-head-of-web-site/13328/8 "2013-06-07T03:35:24Z")

</div>

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