Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 If Usergroup and Forum Id than
WINBOY Offline
Member
***
Posts: 71
Joined: Nov 2012
Post: #1
If Usergroup and Forum Id than
i use below code

Code:
1
2
3
4
5
6
7
8
<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.

(This post was last modified: 01-26-2016 11:37 PM by WINBOY.)
01-25-2016 08:05 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: If Usergroup and Forum Id than
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']}


My Blog
01-29-2016 03:25 PM
Find all posts by this user Quote this message in a reply
WINBOY Offline
Member
***
Posts: 71
Joined: Nov 2012
Post: #3
RE: If Usergroup and Forum Id than
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:
1
2
3
4
5
6
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>

(This post was last modified: 01-29-2016 06:36 PM by WINBOY.)
01-29-2016 06:24 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: If Usergroup and Forum Id than
(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.

My Blog
01-30-2016 08:35 AM
Find all posts by this user Quote this message in a reply
WINBOY Offline
Member
***
Posts: 71
Joined: Nov 2012
Post: #5
RE: If Usergroup and Forum Id than
Dear Bro.
I am not expert.
I am just beginner.
What to remove and where to add which code ? please help.
01-30-2016 06:26 PM
Find all posts by this user Quote this message in a reply
WINBOY Offline
Member
***
Posts: 71
Joined: Nov 2012
Post: #6
RE: If Usergroup and Forum Id than
pls help me bro.
02-23-2016 12:20 AM
Find all posts by this user Quote this message in a reply
xensor Offline
Junior Member
**
Posts: 22
Joined: Jan 2014
Post: #7
RE: If Usergroup and Forum Id than
here this will/should work

Code:
1
2
3
4
5
6
7
8
<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.

10-01-2016 11:15 PM
Find all posts by this user Quote this message in a reply
WINBOY Offline
Member
***
Posts: 71
Joined: Nov 2012
Post: #8
RE: If Usergroup and Forum Id than
Not working bro.
Please Dear Zinga help me.
11-06-2016 11:29 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: