MyBB Community Forums

Full Version: Hide Moderate Tab
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I hide the Moderate tab from all users except moderators/admins?

Forum link: https://tunerheat.com/member.php?action=profile&uid=1

Member_Profile Template:
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->profile}</title>
{$headerinclude}
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/report.js?ver=1804"></script>


<script>
$(document).ready(function(){

$('ul.tabs li').click(function(){
var tab_id = $(this).attr('data-tab');

$('ul.tabs li').removeClass('current');
$('.tab-content2').removeClass('current');

$(this).addClass('current');
$("#"+tab_id).addClass('current');
})

})
</script>

<style>
.container2{
margin: 0 auto;
}



ul.tabs{
margin: 0px;
padding: 0px;
list-style: none;
}
ul.tabs li{
background: none;
color: #fff;
display: inline-block;
padding: 10px 15px;
cursor: pointer;
            background: #181818;
            border: #232323 1px solid;
border-bottom: none;
}

ul.tabs li.current{
background: #0e0e0e;
color: #fff;
border: 1px solid #232323;
border-bottom: none;
}

.tab-content2{
display: none;
padding: 15px;
            background: #181818;
            border: #232323 1px solid;
}

.tab-content2.current{
display: inherit;
}
</style>




</head>
<body>
{$header}
<div class="float_right" style="text-align: center">{$buddy_options}{$ignore_options}{$report_options}</div> <br /><br />
<fieldset>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="75%">
<span class="largetext"><strong>{$formattedname}</strong></span><br />
<span class="smalltext">
({$usertitle})<br />
{$groupimage}
{$userstars}<br />
<br />
<strong>{$lang->registration_date}</strong> {$memregdate}<br />
<strong>{$lang->date_of_birth}</strong> {$membday} {$membdayage}<br />
<strong>{$lang->local_time}</strong> {$localtime}<br />
<strong>{$lang->postbit_status}</strong> {$online_status}
</span>
</td>
<td width="25%" align="right" valign="middle">{$avatar}</td>
</tr>
</table>
</fieldset>

<br />
{$awaybit}{$bannedbit} 


<div class="container2">

<ul class="tabs">
<li class="tab-link current" data-tab="tab-1"> Forum info</li>
<li class="tab-link" data-tab="tab-2">Contact details</li>
<li class="tab-link" data-tab="tab-3">Profile</li>
<li class="tab-link" data-tab="tab-4">Signature</li>
<li class="tab-link" data-tab="tab-5">Comment</li>
   <li class="tab-link" data-tab="tab-6">Moderate</li>
</ul>

<div id="tab-1" class="tab-content2 current">



<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_forum_info}</strong></td>
</tr>
<tr>
<td class="trow1" style="width: 30%;"><strong>{$lang->joined}</strong></td>
<td class="trow1">{$memregdate}</td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->lastvisit}</strong></td>
<td class="trow2">{$memlastvisitdate}</td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->total_posts}</strong></td>
<td class="trow1">{$memprofile['postnum']} ({$lang->ppd_percent_total}){$findposts}</td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->total_threads}</strong></td>
<td class="trow2">{$memprofile['threadnum']} ({$lang->tpd_percent_total}){$findthreads}</td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->timeonline}</strong></td>
<td class="trow1">{$timeonline}</td>
</tr>
{$myprofile_referredby}{$referrals}
{$reputation}
{$warning_level}
</table>



</div>
<div id="tab-2" class="tab-content2">
{$myprofile_buddylist}{$myprofile_visitors}{$contact_details}
</div>
<div id="tab-3" class="tab-content2">
{$profilefields}{$myreactions}
</div>
<div id="tab-4" class="tab-content2">
{$signature}{$memprofile['ougc_awards']}
</div>
<div id="tab-5" class="tab-content2">
{$myprofile_comments}{$myprofile_comments_stats}
</div>
<div id="tab-6" class="tab-content2">
{$modoptions}{$adminoptions}
</div>
</div> 

<br />

{$footer}
</body>
</html>


Thank you
Hi,

First of all install this plugin and change the code in your template

From :
<li class="tab-link" data-tab="tab-6">Moderate</li>


To:
<if $mybb->user['cancp'] then> 
<li class="tab-link" data-tab="tab-6">Moderate</li>
</if>
(10-03-2016, 02:02 PM)un4saken Wrote: [ -> ]Hi,

First of all install this plugin and change the code in your template

From :
<li class="tab-link" data-tab="tab-6">Moderate</li>


To:
<if $mybb->user['cancp'] then> 
<li class="tab-link" data-tab="tab-6">Moderate</li>
</if>

How would I make it visible to super moderators/administrators?
Since i use the same profile layout. I did it like this for super mod & admins.

<if $mybb->user['usergroup'] == 8 then><li><a href="#tab6" style="text-decoration:none">Moderation</a></li></if>
<if $mybb->user['usergroup'] == 3 then><li><a href="#tab6" style="text-decoration:none">Moderation</a></li></if>

Just twice, but once for super mod & once for admins
(10-03-2016, 08:31 PM)thelovelyone Wrote: [ -> ]Since i use the same profile layout. I did it like this for super mod & admins.

<if $mybb->user['usergroup'] == 8 then><li><a href="#tab6" style="text-decoration:none">Moderation</a></li></if>
<if $mybb->user['usergroup'] == 3 then><li><a href="#tab6" style="text-decoration:none">Moderation</a></li></if>

Just twice, but once for super mod & once for admins

Thank you. That worked, but the contents in Moderation tab are not showing?
You should edit the tab number etc. accordingly. Yours does say tab-6 for example.

Mine is like this:
<div id="tab6" class="tab_content">
{$modoptions}
{$adminoptions}
</div>
(10-03-2016, 08:54 PM)thelovelyone Wrote: [ -> ]You should edit the tab number etc. accordingly. Yours does say tab-6 for example.

Mine is like this:
<div id="tab6" class="tab_content">
{$modoptions}
{$adminoptions}
</div>

Thank you! Worked great
Your welcome. You can make the tab titles even cooler using font awesome icons.

E.g.
<if $mybb->user['usergroup'] == 8 then><li><a href="#tab6" style="text-decoration:none"><font color="white"><i class="fa fa-shield" aria-hidden="true"></i>&nbsp;Moderation</font></a></li></if>

And in header templates -> headerinclude, you just need to put this in:
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">

so the icons can be called from the fa icon site.

Outcome: 
[Image: f936567be1754bd79f24fe3caecf8548.png]
(10-03-2016, 09:10 PM)thelovelyone Wrote: [ -> ]Your welcome. You can make the tab titles even cooler using font awesome icons.

E.g.
<if $mybb->user['usergroup'] == 8 then><li><a href="#tab6" style="text-decoration:none"><font color="white"><i class="fa fa-shield" aria-hidden="true"></i>&nbsp;Moderation</font></a></li></if>

And in header templates -> headerinclude, you just need to put this in:
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">

so the icons can be called from the fa icon site.

Outcome: 
[Image: f936567be1754bd79f24fe3caecf8548.png]

Oh that's sweet! Thanks for telling me! Will work on that soon