View Full Version : If Condition for usergroup
WNxWakko
03-19-2006, 10:34 PM
I am trying to have something display in memberinfo but only for certain usergroups. Is there an IF condition that will work for this? If this usergroup then yes else no something similar to that.
Freesteyelz
03-19-2006, 11:03 PM
Use this:
<if condition="is_member_of($bbuserinfo,x, y, z)">
Conditional code bit here...
<else />
Default code bit here...
</if>
Where "x", "y" and "z" are replace them with the Usergroups' IDs.
WNxWakko
03-19-2006, 11:46 PM
I did try that in the memberinfo and it didnt work.
Here was my test,
<if condition="is_member_of($bbuserinfo,6, 54, 85)">
yes
<else />
no
</if>
Everyones profile just says Yes no matter what group they were in.
Freesteyelz
03-20-2006, 12:52 AM
I'm actually using the code for many templates, including Members Info. What are you trying to do so I can try and replicate the problem?
Stangsta
03-20-2006, 01:10 AM
See if this helps you
https://vborg.vbsupport.ru/showthread.php?t=109279
Freesteyelz
03-20-2006, 01:55 AM
Cool. That's the exact code I've been using in my templates. Though, I learned it at vB.com. :)
WNxWakko
03-20-2006, 02:11 AM
Hmm, Ok I figured out what it is doing, but its still not solving my problem.
That code seems to be showing Yes to me on all profiles because I am usergroup 6 so it says ok I will show you YES. But to other members they see No. This in that simple test that is.
Ok, to explain it simple,
I have Teamspeak and VB integrated together. When a member registers and is approved for an account on my site, it automatically gives them access to teamspeak as the DB is shared. Now I have some settings built in profiles via admincp where I can grant them Server Admin, Channel Admin and many other options. Now my Admin usergroups by default have all this already in Teamspeak, but I can also toggle a checkbox in admincp if I want to grant specific rights to certain members.
So I want a condition that will say, If apart of this usergroup say Yes they have this specific access or if box is checked it will also say yes.
I already know the other conditionals, what I cant get to work is based off usergroup. The answer is based on the usergroup of that members I would be viewing not what usergroup I the view is in.
yayvb
03-24-2006, 01:10 AM
I think you may be looking for what I'm looking for. You don't want to limit per usergroup, (ie. yes to admin or no to members) you want to limit if the visitor has the usegroup option set to YES or No depending on your situation. Am I right in thinking this? This way you can go through your usergroups and set which usergroup can access your custom page, etc.
Freesteyelz
03-24-2006, 07:42 AM
I'm still not sure what you mean but you can try:
User:
<if condition="$post[userid] == x">
Usergroup:
<if condition="$post[usergroupid] == y">
Where "x" is replace with UserID and for "y" replace with Usergroup ID.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.