MyBB Community Forums

Full Version: Add Log out Button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So im trying to add a Log Out Button in my Footer.
Used this code

<a rel="nofollow" class="cikis-yap" href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}">{$lang->welcome_logout}</a>

The code works and it Logs you out, but
the Log out button still remains in the footer, how come its still visible.

I want it to disappear after Log out.
you can use template conditionals plugin for above purpose (log out link visible to logged in members only)

<if $mybb->user['uid'] != 0 then>your log out link code</if>
<if $mybb->usergroup['gid'] == 1 then>
//Stuff guests can see
<else>
//Stuff you want them to see if they are logged out
</if> 

Credits to Omar for this
Awesome that worked, thanks guys.
While im at it, how would i go by adding a Alert Pop Up when they click Log Out

Something like 'Are you sure you want to Log Out Yes - No'
^ see replies here for the required java script code
<a rel="nofollow" class="cikis-yap" href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}" onclick="return confirm('Are you sure you want to logout?')">{$lang->welcome_logout}</a>
You guys are the best thank you !
Marked as solved.