MyBB Community Forums

Full Version: Posting links for certain user groups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
Is there code, like an IF statement, that would display an assortment of links only to certain groups? Like VIP members (GID=20) Mods & Admins (GID=3 & 4)

Thanks.
You could probably modify a plugin like this http://mods.mybboard.net/view/hide-links...sts-for-14 also take a search around, I think there are other similar plugins.
I found this one by MattRogowski:

if(!in_array($mybb->user['usergroup'], array('3','4','6')))
{
    error_no_permission();
} 

So adding '20' is easy, no problem there.
Just wondering where I would add the links in to that code, so for example of I wanted to add:
<a href="http://www.website.com/special/link1.html>Link 1</a>
<a href="http://www.website.com/special/link2.html>Link 2</a>
<a href="http://www.website.com/special/link3.html>Link 3</a>

Thanks.







----------

EDIT:

I just tested this:

$allowedgroups = array( '3', '4' );
if ( in_array ( $mybb->user['usergroup'], $allowedgroups )
{
    
<a href="http://www.website.com/special/link1.html>Link 1</a>
<a href="http://www.website.com/special/link2.html>Link 2</a>
<a href="http://www.website.com/special/link3.html>Link 3</a>

}
else
{
    error_no_permission();
}

Doesn't seem to work.

I'd like to place these links on the footer, but this code doesn't seem to work for it.
Any ideas how to make it work?

Thanks.
For PHP to work in templates you need Yumi's PHP in templates plugin.
Okay just enabled that plugin, using either of the above codes still not working Sad