Not Solved PHP in Templates and Template Conditionals
Not Solved
(2016-01-30, 08:30 AM)Dr_The_One Wrote: i use below code
<if (in_array($mybb->user['usergroup'], array(4,8,9)) && in_array($forum['fid'], array(168))) then>

<span class="smalltext">
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date}<br />{$lang->by} {$lastpost_profilelink}</span>

<else> Protected Forum
</if>

But it show 'Protected Forum' under all forum last post rather than in  forum id 168.
Is there any issue with code?

Look at your if statement. If the user is in group 4, 8, or 9 and is viewing forum 168 then display the last post information; else (meaning user is not in group 4, 8, or 9 or the forum isn't 168), then display Protected Forum.

<if (in_array($mybb->user['usergroup'], array(4,8,9)) || ! in_array($forum['fid'], array(168))) then>

<span class="smalltext">
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date}<br />{$lang->by} {$lastpost_profilelink}</span>

<else> Protected Forum
</if>

My modified code shows the last post information if the user is in a privileged group OR the user is viewing a non-protected forum.
Reply


Messages In This Thread
RE: PHP in Templates and Template Conditionals - by laie_techie - 2016-02-03, 08:11 PM
RE: Template conditionals - by expat - 2015-01-31, 05:28 AM

Forum Jump:


Users browsing this thread: 11 Guest(s)