View Full Version : List Usergroup in Postbit Legacy?
Jubei
07-25-2007, 08:05 PM
Is there a way to list the Usergroup in the postbit legacy, say in the format:
Class: Full Member/Moderator/Admin (etc)
I don't want this to be in usertitle, as the two will be kept separate.
Thanks.
SCRIPT3R
07-25-2007, 08:15 PM
sure. you could edit the display properties and place the following where needed repsectively within your postbit template.
<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if>
<if condition="$post['rank']"><div class="smallfont">$post[rank]</div></if>
Jubei
07-25-2007, 09:33 PM
That's User ranks though and not Usergroups right? I'm after the latter, since these classes would change via the promotion system.
Kirk Y
07-25-2007, 09:43 PM
I'm not sure if the Usergroup name is accessible via a variable. If I'm right in there not being one, you could use a set of conditional statements to create one.
<if condition="is_member_of($post, 6)">Administrator</if>It might be simpler to do it via a Plugin, as nested template conditionals can get kind of messy.
Create a new plugin at hook location "postbit_display_start" with the following:
if (is_member_of($post, 6)){
$usergroup = "Administrator";
}
elseif (is_member_of($post, 5)){
$usergroup = "Usergroup 5";
}
elseif (is_member_of($post, 4)){
$usergroup = "Usergroup 4";
}
elseif (is_member_of($post, 3)){
$usergroup = "Usergroup 3";
}
Then place $usergroup in your postbit template wherever you'd like their Usergroup name to show up.
In the above codes, the integer after "$post," represents the Usergroup ID we're matching against.
Jubei
07-25-2007, 09:50 PM
I've seen it done on a few other boards, so I don't imagine it being that difficult.
Can you direct me to said plugin please?
Kirk Y
07-25-2007, 09:55 PM
You must've posted while I was editing -- look at my post above.
Edit: Just ran across an alternative solution. Use the following in your postbit template wherever you'd like the Usergroup name displayed (No plugin needed):
{$GLOBALS[vbulletin]->usergroupcache[$post[usergroupid]][title]}
Jubei
07-25-2007, 10:00 PM
Okay, gotcha. I'll give this a try and get back to you.
Thanks a lot!
King Kovifor
07-25-2007, 10:07 PM
User group is located within the $userinfo array, which should be available in the postbit, but don't quote me on the availability part.
Kirk Y
07-25-2007, 10:39 PM
No $userinfo is only available in the MEMBERINFO templates, to my knowledge.
King Kovifor
07-25-2007, 11:21 PM
Reason I said don't quote me on it. I know it is stored in the userinfo though.
Kirk Y
07-25-2007, 11:29 PM
Any idea what the array key is?
Jubei
07-26-2007, 12:21 PM
Good work, Kirk Y, glad there's a simple solution.
One question, it displays 'Adminstrator'. Now is there a way I can put Rank: before it? I would also want that part bold.
Thanks.
Kirk Y
07-26-2007, 02:36 PM
<strong>Rank:</strong> {$GLOBALS[vbulletin]->usergroupcache[$post[usergroupid]][title]}
Jubei
07-26-2007, 05:50 PM
Thank you again, Kirk. Now here's something else you might be able to help me with: How would I go about having a user's usergroups listed in their profile page? I'd like it on the left just under Join Date, in a bulleted list, e.g.
- Administrator
- Senior Member
Thanks.
Kirk Y
07-26-2007, 05:58 PM
That would require a little modding, you might want to make a request and see if someone can put something together for you.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.