View Full Version : How to tell if a post is by a member of a certain usergroup
BirdOPrey5
05-21-2010, 10:23 PM
I know the below code tells the forum to run code if the current user is a member of a certain usergroup:
if(is_member_of($vbulletin->userinfo, 5, 6, 7))
//stuff goes here if true
My question is, is there similar code to decide to run the if statement based on the usergroup of the current poster. Basically I'm in the postbit template and want a conditional to do something if the poster is in a certain usergroup(s). Maybe something like:
if(is_member_of($vbulletin->posterinfo, 5, 6, 7))
//stuff goes here if true
borbole
05-21-2010, 10:28 PM
Try this:
if(is_member_of($vbulletin->post, 5, 6, 7))
{
//your code here to excute if true
}
BirdOPrey5
05-21-2010, 10:47 PM
Try this:
if(is_member_of($vbulletin->post, 5, 6, 7))
{
//your code here to excute if true
}
Doesn't seem to be working, it's never coming back true no matter the groups I use.
and just to be clear, what I'm really using is
<if condition="(is_member_of($vbulletin->post, 2, 6, 20, 21))">
I forgot the 'condition=' in the example...
borbole
05-21-2010, 10:56 PM
Doesn't seem to be working, it's never coming back true no matter the groups I use.
and just to be clear, what I'm really using is
<if condition="(is_member_of($vbulletin->post, 2, 6, 20, 21))">
I forgot the 'condition=' in the example...
Ah, you want it to use in a template. From your op, I thought you needed the rraw php code.
Anyway, try this:
<if condition="is_member_of($post, 2, 6, 20, 21 )">
<!--your code here-->
</if>
That should do the trick.
BirdOPrey5
05-21-2010, 11:27 PM
*Perfect* Much thanks!
May I ask did you read about these functions somewhere or just something you picked up along the way? I've made a number of php apps but clueless when it comes to vB.
Lynne
05-21-2010, 11:36 PM
*Perfect* Much thanks!
May I ask did you read about these functions somewhere or just something you picked up along the way? I've made a number of php apps but clueless when it comes to vB.
vBulletin API (http://members.vbulletin.com/api/)
BirdOPrey5
05-22-2010, 01:48 AM
vBulletin API (http://members.vbulletin.com/api/)
Thanks... is the 3.8 documentation still available?
borbole
05-22-2010, 01:29 PM
*Perfect* Much thanks!
May I ask did you read about these functions somewhere or just something you picked up along the way? I've made a number of php apps but clueless when it comes to vB.
You are welcome. Glad to have been of help :)
Personally, I did a lot of research here by searching the forums and studying the vb files/templates. And pretty soon everything fell in place and became crystal clear. These forums are a gold mine of information. One can learn a lot.
Lynne
05-22-2010, 01:48 PM
Thanks... is the 3.8 documentation still available?
A lot of it hasn't changed. And, you can always just look the function up in the files if you are wondering if it's changed.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.