MyBB Community Forums

Full Version: Hide certain <div>'s for membergroups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

Unfortunately my other posts remained unanswered.
But I'll try again,

I'm looking for a way to hide certain forumparts for membergroups.

Like premium members shouldn't see my google ads div in the header template.

And the post button in my chat should be visible to all except for usergroup "Chatmute".

How do I hide or show certain <divs> or parts from the forum for assigned usergroups?

Thank you in advance!
Skorm92
This is a simple CSS trick. Say:

1. Your Premium Member Group ID is : 9
2. Your div for google ad is:

<div>Your Google ad code here</div>

Now wrap the div in a special class, dependent on group ID. The code will be:

<div class="adv{$mybb->user['usergroup']}">Your Google ad code here</div>

Now go to your global.css and add this:

.adv9 { display: none; }

If you want to hide the div from multiple user groups, say group ID 4, 8 & 9; you can do it this way:

.adv4, .adv8, .adv9 { display: none; }

Use the same trick for different divs and different groups to make the divs usergroup dependent.
Thank you!

That worked for me!
Good way to get banned from AdSense. Downloading the ad code but not displaying it? An impression getting counted without an actual impression?

You would be better off using MyAdvertisements or similar plugins.