The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Check Thread Starter Usergroup and Execute Code
Hello,
How do I check the thread starter's usergroup and execute code based on that? I mean, something like this: Code:
<vb:if condition="is_member_of($threadstarter, 5,6,7,9)"> ........ <vb:else /> ............. </vb:if> |
#2
|
|||
|
|||
yes where exactly do you want to do this? The is_member_of should go into your php file and set a boolean to true or false and you can use if statement in your template to behave accordingly
|
#3
|
||||
|
||||
Well, its in a template, the threadbit template actually.
|
#4
|
||||
|
||||
The $threads query (used to get information for the threadbit template) does not grab the threadstarter's information (like the usergroup). So, you would actually need to add another query per threadbit per page in order to grab that information.
|
#5
|
||||
|
||||
Quote:
What that query should be? Sorry, but I am totally lost here. |
#6
|
||||
|
||||
To be honest, I would not suggest doing that. Is there some other way to do what you want? What is your goal?
|
#7
|
||||
|
||||
Quote:
My goal is to highlight the threadbit in a separate color if the thread started by a member belongs to a specific group. That's it. |
#8
|
|||
|
|||
I think the issue is that you normally try not to add queries because they take up time. The user table is already joined in that query to get the info for the last poster, which may be why there's not usergroup coloring for thread starters by default. Anyway, you could just add a query at threadbit_display to look up the info, but then you're adding one query for each thread. The other thing you could do one "big" query similar to the one that's being done (I'm looking in forumdisplay.php), maybe at forumdisplay_query. I don't know which one's better, it probably depends on a lot of factors.
Anyway, if you didn't care at all about adding queries I think you could do this at threadbit_display: Code:
$starterinfo = fetch_userinfo($thread['postuserid']); $thread['starter_musername'] = fetch_musername($starterinfo); Then you could use {vb:raw thread.starter_musername} in the template. That assumes that what you want is to have the username colored by group in the same way that it would be in other places. (I haven't tried the above code). |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|