MyBB Community Forums

Full Version: how to make a section of template just shown by specified user group?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have much banner in my site, that banner will shown for guest and member
but for VIP member, admin, and moderator that banner is hiding
i using plugin for ads like myadvertisement, but that make some query and slow down my forum (CMIIW) how to make some modification in php script and template for this?
thanks for help Smile
You'd need the PHP in Templates plugin by Yumi.
(2011-05-15, 04:23 PM)Shukaku Wrote: [ -> ]You'd need the PHP in Templates plugin by Yumi.

thanks for help. where i can get that plugin? and how to apply it in order to fit what I mean?
Install this: http://community.mybb.com/thread-31860.html

To place an ad just for specific usergroups, do like this;

Copy/Paste this code in the template where you want to show ads only for those specific groups.
$groups = array(1,2,5,7); // Add usergroup ID here replacing 1,2,5,7 etc.
<if in_array($mybb->user['usergroup'],$groups) then>
YOUR_AD_CODE_GOES_HERE
</if>
(2011-05-15, 04:35 PM)Yaldaram Wrote: [ -> ]Install this: http://community.mybb.com/thread-31860.html

To place an ad just for specific usergroups, do like this;

Copy/Paste this code in the template where you want to show ads only for those specific groups.
$groups = array(1,2,5,7); // Add usergroup ID here replacing 1,2,5,7 etc.
<if in_array($mybb->user['usergroup'],$groups) then>
YOUR_AD_CODE_GOES_HERE
</if>

Alhamdulillah, suqron for help
Thanks for the compliments Big Grin
(2011-05-15, 04:56 PM)Yaldaram Wrote: [ -> ]Thanks for the compliments Big Grin

i installed http://mybbhacks.zingaburga.com/showthread.php?tid=260
add the code, but shown error in header :
[Image: 10423121bcb27770e91e04df10986ae96f883416.jpg]

how to fix this?
Can you please paste your complete code what you've added ?
in header template just like intruction

$groups = array(1,2,5,7); // Add usergroup ID here replacing 1,2,5,7 etc.
<if in_array($mybb->user['usergroup'],$groups) then>
YOUR_AD_CODE_GOES_HERE
</if> 
Change to this:
<if in_array($mybb->user['usergroup'],array(1,2,5,7)) then>
YOUR_AD_CODE_GOES_HERE
</if> 
Pages: 1 2