MyBB Community Forums

Full Version: Trying to create custom logout button.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to do a custom logout button in the header. I've searched the docs and I can't really find a solution to my problem.

1) How does mybb decide which header welcomeblock to display.
2) if($mybb->user['uid'] != 0)
{
       eval('$logoutlink = "'.$templates->get('index_logoutlink').'";');
}
WHERE is $logoutlink used?
3) How can I use logoutlink in my own template file to show/hide my own custom logout button. (my logout button is not in the welcomeblock)
1. MyBB checks in global.php; if the member is admin ($mybb->usergroup['cancp'] == 1) or moderator ($mybb->usergroup['canmodcp'] == 1) else just a member for logged in ones ($mybb->user['uid'] != 0) or its a guest.

2. $logoutlink is used in 'index_boardstats' template.

3. Just use the standard logout link for a linked text or button and show / hide it using css class according to member / guest state. This way:

<a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}" class="button logout_button{$mybb->user['uid']}">{$lang->welcome_logout}</a>
<style type="text/css">.logout_button0 {display: none!important;}</style>
(2014-10-29, 04:32 AM)effone Wrote: [ -> ]1. MyBB checks in global.php; if the member is admin ($mybb->usergroup['cancp'] == 1) or moderator ($mybb->usergroup['canmodcp'] == 1) else just a member for logged in ones ($mybb->user['uid'] != 0) or its a guest.

2. $logoutlink is used in 'index_boardstats' template.

3. Just use the standard logout link for a linked text or button and show / hide it using css class according to member / guest state. This way:


<a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}" class="button logout_button{$mybb->user['uid']}">{$lang->welcome_logout}</a>
<style type="text/css">.logout_button0 {display: none!important;}</style>

Thanks for this quick hack and the information provided.