MyBB Community Forums

Full Version: Mod/Admin options now showing on user profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good morning all, 

When I'm on a user's profile page logged in as an admin or moderator it doesn't show the moderator and administrator tab. I am using the Dazzle theme by audentio: https://community.mybb.com/mods.php?acti...w&pid=1152 

I've got the following code in my member_profile template: 

<div id="tab-container" class="tab-container">
  <ul class='etabs'>
    <li class='tab'><a href="#membertab-generalinfo"><i class='fa fa-th-list'></i> {$lang->users_forum_info}</a></li>
    <li class='tab'><a href="#membertab-contactinfo"><i class='fa fa-envelope'></i> {$lang->users_contact_details}</a></li>
    <li class='tab'><a href="#membertab-moreinfo"><i class='fa fa-list-alt'></i> {$lang->users_additional_info}</a></li>
    <li class='tab modonly'><a href="#membertab-mod"><i class='fa fa-wrench'></i><span style="text-indent: -998px;visibility: hidden;margin-left: -3px;">.</span></a></li>
    <li class='tab adminonly'><a href="#membertab-admin"><i class='fa fa-cog'></i><span style="text-indent: -998px;visibility: hidden;margin-left: -3px;">.</span></a></li>
  </ul>

All the tabs work, in fact, if do put "#membertab-admin"/"#membertab-mod" in the url it actually shows the tab. When removing the part "modonly" / "adminonly" it will be like this: 


<li class='tab'><a href="#membertab-mod"><i class='fa fa-wrench'></i><span style="text-indent: -998px;visibility: hidden;margin-left: -3px;">.</span></a></li>
<li class='tab'><a href="#membertab-admin"><i class='fa fa-cog'></i><span style="text-indent: -998px;visibility: hidden;margin-left: -3px;">.</span></a></li>

[Image: 189afa9057.png]


When I've done that the tabs show like they are supposed to, but all users will see them, when adding the mod/admin only part back and logging in as an admin/mod I can't see the tabs. 


How can I make it that those two tabs are only shown when an moderator / admin is logged in? 


Additional system information:
- Mybb version 1.8.20

- PHP version 7.2.16
- SQL Engine MySQLi 5.5.60

Thanks in advance! 
Hugo.
You need to remove the tabs from the DOM for members.
Use jQuery. Set a variable through any admin only and / or mod only template. Check the variable after document load. If it is set then the user is admin / mod, else don't try to hide it but remove the tab completely.