2013-07-26, 05:54 PM
2013-07-26, 06:08 PM
<if in_array($mybb->user['additionalgroups'], array('91', '23', '62')) then>
can you elaborate second requirement.
though you can restrict content based on user IDs, I'd suggest to try group based permissions.
<if $mybb->user['uid'] != X then>
content not visible to user X
</if>
<if $mybb->usergroup['gid'] != Y then>
content not visible for users of group Y
</if>
(template conditionals plugin)
2013-09-04, 07:50 PM
deleted
2015-08-03, 08:46 AM
(2013-07-26, 06:08 PM).m. Wrote: [ -> ]<if in_array($mybb->user['additionalgroups'], array('91', '23', '62')) then>
(template conditionals plugin)
Hi, this code doesn't work Is there a new code for Mybb 1.8?
Thank you
2015-08-03, 10:01 AM
^ have you installed template conditionals plugin ? can you post exact code you have used ..
2015-08-03, 10:15 AM
Hi, I have used this code in postbit template:
If user is in additionalgroups 45,42,23 then usertitle with style is shown.
Maybe the code doesn't work in postbit template but only in showthread template?
I have PHP and Template Conditionals (2.0), I use <if> without problems but with this code doesn't work.
For example this code works perfectly also in postbit template:
<if in_array($mybb->user['additionalgroups'], array(45,42,23)) then>
<li style="background-color:blue;">
<i class="fa fa-star"></i>
{$post['usertitle']}
</li>
</if>
If user is in additionalgroups 45,42,23 then usertitle with style is shown.
Maybe the code doesn't work in postbit template but only in showthread template?
I have PHP and Template Conditionals (2.0), I use <if> without problems but with this code doesn't work.
For example this code works perfectly also in postbit template:
<if $mybb->user['usergroup'] == 4 then>{$post['usertitle']}</if>
2015-08-03, 09:40 PM
$mybb->user['additionalgroups'] is not an array. You need to separate it by comma before checking it with array_intersect() rather than in_array().
Also, please don't hijack multiple other old threads, just open a new one..
<if array_intersect(array(45,42,23), explode(",", $mybb->user['additionalgroups'])) then>
Also, please don't hijack multiple other old threads, just open a new one..
2015-08-04, 01:00 AM
(2015-08-03, 09:40 PM)Destroy666 Wrote: [ -> ]$mybb->user['additionalgroups'] is not an array. You need to separate it by comma before checking it with array_intersect() rather than in_array().
<if array_intersect(array(45,42,23), explode(",", $mybb->user['additionalgroups'])) then>
Also, please don't hijack multiple other old threads, just open a new one..
Hi, it doesn't work the stuff into <if etc additionalgroups> is always shown to all users, not only to 45,42,23 additional groups
And sorry, in future I'll add new thread :x
2015-08-04, 01:54 AM
You must be testing/describing it wrong if both the code above and this (which is another simple method): http://mybbhacks.zingaburga.com/showthre...6#pid18696 are not working for you.
I just tested with different numbers and it works for me.
I just tested with different numbers and it works for me.