The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
In the threadbit, I have this piece of code:
HTML Code:
<span style="cursor:pointer" onclick="window.open('member.php?$session[sessionurl]u=$thread[postuserid]', '_self')">$thread[postusername]</span> Can this be done with template conditionals, if so, which one? All the ones I have tried test for the user rather than the thread starter. I am thinking something like : <if condition="$threadstarter = usergroupid 5,6"> for example. Does a template conditional exist for this kind of test? TIA for any suggestions. |
#2
|
||||
|
||||
![]()
Try:
HTML Code:
<if condition="is_member_of($thread[postuserid], 6)">stuff</if> |
#3
|
|||
|
|||
![]()
Thanks Lynne, I tried it and got unexpected results. I thought it worked at first. I expected that only the administrators would be selected but it also select post from one of the registered users who is not an administrator.
If I do an explicit "<if condition="$thread['postuserid'] == 1">" only the administrator posts are correctly selected but what I want is to be able to select the usergroupid to which $thread[postuserid] belongs. When I changed you example to 2 thinking it would select all the "registered users", it didn't select any even through some do exist. Any ideas? |
#4
|
||||
|
||||
![]()
Now that I relook at that condition, I can see it won't work. It needs the usergroupid, not the id of the user. Instead of $thread[postuserid], you can try $thread[groupuserid] or just $thread, but I don't think the usergroupid is ever grabbed. And, if it isn't, then you will have to get it with the help of a plugin you write.
|
#5
|
|||
|
|||
![]()
That's what I thought just needed to verify it. thanks very much.
|
#6
|
||||
|
||||
![]()
When you grab the user info, you will want to fetch all the info for the threads all in one query.
|
#7
|
|||
|
|||
![]()
Thanks, I haven't started on the query yet, are you thinking I need a join? I was thinking that I would try to do a select on user where userid = $thread[postuserid] and grab the usergroupid from there, like
Code:
$getUserGroup= $vbulletin->db->query_read("SELECT usergroupid FROM `user` WHERE `userid`= $thread[postuserid]); I only have 4 usergroups that I care about so it not that big of a problem. I would wrap the conditional around my display code: HTML Code:
<if condition="$is_admin">
I am thinking that the threadbit_display hook, should that be correct? If you are thinking something different, I'd be glad to hear about it. thanks, Michael |
#8
|
||||
|
||||
![]()
Look for the query in forumdisplay that grabs all the threads to display there. Right above the query is hopefully a hook. Use that hook to grab the usergroupid of the thread starter.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|