MyBB Hacks

Full Version: If Usergroup and Forum Id than
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i use below code

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?

Please Help me.

One way to debug things is just to print out the variables, e.g put the following before the <if> tag:

Code:
{$mybb->user['usergroup']} -- {$forum['fid']}

I didnt understand bro.
If i put your code before <if than how it will be work?
Please can you post edited code?
thank you.
i tried below code also but result remain same means Proected forum shown under all forums last post.

Code:
if {$mybb->user['usergroup']} = '4,8,9'  &&  {$forum['fid']} = '168,169'  then>
<td>{$forum['lp_avatar']}</td>
<td><span class="smalltext"><a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br/>{$lastpost_date} {$lastpost_time}<br/> {$lastpost_profilelink}</span></td>
	<else> Protected Forum
</if>

(01-29-2016 06:24 PM)WINBOY Wrote: [ -> ]I didnt understand bro.
If i put your code before <if than how it will be work?
It won't work.
It will just help you understand why it doesn't.
Dear Bro.
I am not expert.
I am just beginner.
What to remove and where to add which code ? please help.
pls help me bro.
here this will/should work

Code:
<if (in_array($mybb->user['usergroup'], array(4,8,9)) && $forum['fid'] == 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>


putting the fid in a array when there is no need to can cause issues. sometimes it just better to have actually match the single fid and such.

Not working bro.
Please Dear Zinga help me.
Reference URL's