MyBB Community Forums

Full Version: Need help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to make my first template for mybb, I have two buttons that pop out slide out menu for private messages and usercp, what I am trying to accomplish is that these buttons are hidden unless user is logged in meaning I don't want unregistered user's to see these two button's. Here is my code for my header file

Quote:<div id="container">
<a name="top" id="top"></a>
<div id="header">
<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a></div>

<hr class="hidden" />
<nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1">
<a href="/private.php?fid=1">Private Message</a>
<a href="/private.php?fid=1">Inbox</a>
<a href="/private.php?action=send">Compose</a>
<a href="/private.php?fid=2">Sent</a>
<a href="/private.php?fid=3">Drats</a>
<a href="/private.php?fid=4">Trash</a>
<a href="/private.php?action=tracking">Tracking</a>
<a href="/private.php?action=folders">Edit Folders</a>

</nav>
<nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-right" id="cbp-spmenu-s2">
<center>{$lang->welcome_pms_usage}</center>
<a href="/private.php?fid=1">Private Message</a>
<a href="/private.php?fid=1">Inbox</a>
<a href="/private.php?action=send">Compose</a>
<a href="/private.php?fid=2">Sent</a>
<a href="/private.php?fid=3">Drats</a>
<a href="/private.php?fid=4">Trash</a>
<a href="/private.php?action=tracking">Tracking</a>
<a href="/private.php?action=folders">Edit Folders</a>

</nav>




<div class="main">


<center>
<button id="showLeft" class="buttons">UserCP</button>
<button id="showRight">Message</button>
</center>




</div>
</div>
<!-- Classie - class helper functions by @desandro https://github.com/desandro/classie -->
<script src="/menu/js/classie.js"></script>
<script>
var menuLeft = document.getElementById( 'cbp-spmenu-s1' ),
menuRight = document.getElementById( 'cbp-spmenu-s2' ),
menuTop = document.getElementById( 'cbp-spmenu-s3' ),
menuBottom = document.getElementById( 'cbp-spmenu-s4' ),
showLeft = document.getElementById( 'showLeft' ),
showRight = document.getElementById( 'showRight' ),
showTop = document.getElementById( 'showTop' ),
showBottom = document.getElementById( 'showBottom' ),
showLeftPush = document.getElementById( 'showLeftPush' ),
showRightPush = document.getElementById( 'showRightPush' ),
body = document.body;

showLeft.onclick = function() {
classie.toggle( this, 'active' );
classie.toggle( menuLeft, 'cbp-spmenu-open' );
disableOther( 'showLeft' );
};
showRight.onclick = function() {
classie.toggle( this, 'active' );
classie.toggle( menuRight, 'cbp-spmenu-open' );
disableOther( 'showRight' );
};
showTop.onclick = function() {
classie.toggle( this, 'active' );
classie.toggle( menuTop, 'cbp-spmenu-open' );
disableOther( 'showTop' );
};
showBottom.onclick = function() {
classie.toggle( this, 'active' );
classie.toggle( menuBottom, 'cbp-spmenu-open' );
disableOther( 'showBottom' );
};
showLeftPush.onclick = function() {
classie.toggle( this, 'active' );
classie.toggle( body, 'cbp-spmenu-push-toright' );
classie.toggle( menuLeft, 'cbp-spmenu-open' );
disableOther( 'showLeftPush' );
};
showRightPush.onclick = function() {
classie.toggle( this, 'active' );
classie.toggle( body, 'cbp-spmenu-push-toleft' );
classie.toggle( menuRight, 'cbp-spmenu-open' );
disableOther( 'showRightPush' );
};

function disableOther( button ) {
if( button !== 'showLeft' ) {
classie.toggle( showLeft, 'disabled' );
}
if( button !== 'showRight' ) {
classie.toggle( showRight, 'disabled' );
}
if( button !== 'showTop' ) {
classie.toggle( showTop, 'disabled' );
}
if( button !== 'showBottom' ) {
classie.toggle( showBottom, 'disabled' );
}
if( button !== 'showLeftPush' ) {
classie.toggle( showLeftPush, 'disabled' );
}
if( button !== 'showRightPush' ) {
classie.toggle( showRightPush, 'disabled' );
}
}
</script>

<div class="menu">
<ul>
<li><a href="{$mybb->settings['bburl']}/search.php"><img src="{$theme['imgdir']}/toplinks/search.gif" alt="" title="" />{$lang->toplinks_search}</a></li>
<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>
<li><a href="{$mybb->settings['bburl']}/calendar.php"><img src="{$theme['imgdir']}/toplinks/calendar.gif" alt="" title="" />{$lang->toplinks_calendar}</a></li>
<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><img src="{$theme['imgdir']}/toplinks/help.gif" alt="" title="" />{$lang->toplinks_help}</a></li>
</ul>
<hr class="hidden" />
<div id="panel">
{$welcomeblock}
</div>
</div>
<hr class="hidden" />
<br class="clear" />
<div id="content">
{$pm_notice}
{$bannedwarning}
{$bbclosedwarning}
{$unreadreports}
{$pending_joinrequests}
<navigation>
<br />
</div>
Use header_welcomeblock_guest and header_welcomeblock_member templates to archieve this.
The problem with that is that it brings up the welcome back blocks and I don't want that, If you go to my site you will see what I mean 71.229.225.16/index.php, if you click the usercp button it will slide out a menu containing usercp stuff that is what I want hidden, how in my tag would I do that

never mind mate I found it that was easy enough lol thank you