MyBB Community Forums

Full Version: How can I show some HTML only to a certain role?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I added some ads to my site, but I don't want it to be shown to some donating users. How can I do it inside a template?

At the end of my footer template I have:

Quote:<script src="http://ads33751.hotwords.com.br/show.jsp?id=33751&cor=005F00"></script>

But I wanted it to not be shown to "donating" group I created. Is this possible?

thanks a lot
Try the conditional templates plug in from mybbhacks.

http://mybbhacks.zingaburga.com/showthread.php?tid=464
Isn't there something native on MyBB that I could use to accomplish this?

Leefish : and how can I check if the user has a certain group inside the template?
You need to know if the user is in a usergroup. You can achieve this by using a plugin, or you can use the suggested plugin to build if else statements in multiple templates.

Your template statement could look like this

<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,5,6)) then> stuff for usergroup 4,5,6</if>

or

<if !in_array($GLOBALS['mybb']->user['usergroup'], array(4,5,6)) then> stuff for other usergroups than 4,5,6</if>

This if else in templates is not natively supported in MyBB.
(2012-09-14, 05:28 PM)Leefish Wrote: [ -> ]You need to know if the user is in a usergroup. You can achieve this by using a plugin, or you can use the suggested plugin to build if else statements in multiple templates.

Your template statement could look like this

<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,5,6)) then> stuff for usergroup 4,5,6</if>

or

<if !in_array($GLOBALS['mybb']->user['usergroup'], array(4,5,6)) then> stuff for other usergroups than 4,5,6</if>

This if else in templates is not natively supported in MyBB.



Thanks a lot , worked perfectly