MyBB Community Forums

Full Version: Template conditions for various use
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I used below variable for custom usertitle in post.
<if $post['usergroup'] == 12 then><span class="Diamond">{$post['usertitle']}</span>
<else>{$post['usertitle']}
</if>


But I also want to show usertitle as above in member profile and in members list page.
Please guide how to use it?
Thank you.
for the member profile page, you can try using $memprofile instead of $post
<if $memprofile['usergroup'] == 12 then><span class="Diamond">{$usertitle}</span>
<else>{$usertitle}
</if>
Thanks it works...But for members list page what to use?
Rep+.
^ you can try like below [template : memberlist_user]
<if $user['usergroup'] == 12 then><span class="Diamond">{$user['usertitle']}</span>
<else>{$user['usertitle']}
</if>
Perfect..
Thanks and Rep+ .m.
I want to hide specific code for specific usergroups (e.g 2,3) in a specific category/forum (FID 2,3) & that usergroup (e.g 2,3) should able to view such type specific code inside post in all other forums of board except FID2,3 .

I try to use below condition but it not working , it also hide that code for that specific group in other forums of the board also and show
!!! You can not see!!! used in below code everywhere.

<if (in_array($mybb->user['usergroup'], array(2,3)) || ! in_array($forum['fid'], array(3,4))) then>
	!!! You can not see!!!
	<else>
code for hide to usergroup 2,3 in forums 3,4
		</if>

Please guide.
thank you.
where exactly you want to use such code - in which template ?

you can try it like below
<if (in_array($mybb->user['usergroup'], array(2,3)) && in_array($forum['fid'], array(3,4))) then>
	!!! You can not see!!!
<else>
code for hide to usergroup 2,3 in forums 3,4
</if>
@.m. If I am not wrong, you missed ! ...
<if (in_array($mybb->user['usergroup'], array(2,3)) && ! in_array($forum['fid'], array(3,4))) then>

Even this does not work. It shows !!! You can not see!!! message to usergroup 2,3 in all forums.
Actually I am trying it in Lock content plugin in "lock form" template.

Is it possible?
Thank you.