The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
What Conditional do I need to specify *Secondary* User Groups?
If I want a section of code in a PHP file to apply to Administrators (Group ID 6) only, I might use the following conditional:
PHP Code:
However, that conditional only works if the Primary User Group for a user is Group ID 6. How does this conditional need to be modified so that it also works if a user's Secondary User Group is Group ID 6? Thanks! |
#2
|
||||
|
||||
$groups = fetch_membergroupids_array($bbuserinfo);
if(in_array(6, $groups)) { } or, if you want to combine... $groups = fetch_membergroupids_array($bbuserinfo); if(in_array(6, $groups) OR $bbuserinfo['usergroupid'] == 6) { } |
#3
|
||||
|
||||
Quote:
|
#4
|
||||
|
||||
Quote:
If so, than I can tell you that I am talking about the vB PHP files. And in that case, could you give me an example of the proper syntax to use with "is_member_of"? Thanks! |
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
Hey Ocean.
Yes, you're right in fact. I was under the impression that the function only gets the secondary group ids, but it also fetches the primary group, by default Code:
function fetch_membergroupids_array($user, $getprimary = true) Code:
function is_member_of($userinfo, $usergroupid) |
#7
|
||||
|
||||
Quote:
so is_member_of($var, x) will work |
#8
|
||||
|
||||
Quote:
And that being the case, is this the proper syntax? PHP Code:
Or am I formatting it wrong? |
#9
|
||||
|
||||
should be:
if (is_member_of($bbuserinfo, 6)) { } |
#10
|
||||
|
||||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|