Display code to just an admin in vBulletin 5

Posted 2 years ago

When skinning a template in vBulletin 5, you may need to 1, check if there’s a user and two check if that user is an admin. Use the command to perform a conditional check.


<vb:if condition="!$user OR $user['is_admin']">
 // Code only viewable to a admin
</vb:if>

You can take this a step further and show one piece of code to an admin and something else to other users.


<vb:if condition="!$user OR $user['is_admin']">
 // Code only viewable to a admin
<vb:else />
 // Code viewable to all other users
</vb:if>