View Full Version : Help Please with Conditionals
MikeWarner
08-29-2009, 02:11 PM
Hi - I'm trying to highlight the thread title cell of threads posted within a specific forum posted by a specific usergroup (also within search results).
The conditional basically needs to say - <if thread is posted in forumid=1 and thread starter is usergroup=2>Do This</if>
I have attached an image showing to sort of highlight I'm after - anyone know which templates I need to edit (for search results and in forum thread list).
Many many thanks for any help you can give me.
Lynne
08-29-2009, 02:44 PM
Probably something like:
<if condition="$thread['forumid'] == xx AND is_member_of($thread['postuserid'], yy)">
stuff
<else />
other stuff
</if>
I'm not really sure if you can do $thread['postuserid'] in the is_member_of function - you can look it up in the API (in Quick Links).
MikeWarner
08-29-2009, 04:24 PM
Hi - thanks for replying. This is what I've added in threadbit template:
<if condition="$thread['forumid'] == 87 AND is_member_of($thread['postuserid'], 6)">
<td class="alt1" id="td_threadtitle_$thread[realthreadid]" title="$thread[preview]" style="BACKGROUND-COLOR: yellow">$thread[title_editable]>
<else />
<td class="alt1" id="td_threadtitle_$thread[realthreadid]" title="$thread[preview]">
</if>
It isn't working - it does nothing. I tried doing the highlight with no conditional and it worked, so it must be the conditional part. Please help. Thanks. :)
Lynne
08-29-2009, 05:17 PM
Did you look at the API for is_member_of?
is_member_of (line 384)
Works out if a user is a member of the specified usergroup(s)
This function can be overloaded to test multiple usergroups: is_member_of($user, 1, 3, 4, 6...)
boolean is_member_of (array $userinfo, integer $usergroupid, [boolean $cache = true])
array $userinfo: User info array - must contain userid, usergroupid and membergroupids fields
integer $usergroupid: Usergroup ID to test
boolean $cache: Pull result from cacheSo, as seen, it needs more info passed to it. You may have to do a join on the thread query to get the usergroupid of the user also.
MikeWarner
08-29-2009, 05:42 PM
Hi Lynne - thanks again, but that stuff is a foreign language to me. :(
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.