![]() |
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! |
$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) { } |
Quote:
|
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! |
Quote:
|
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) |
Quote:
so is_member_of($var, x) will work :) |
Quote:
And that being the case, is this the proper syntax? PHP Code:
Or am I formatting it wrong? |
should be:
if (is_member_of($bbuserinfo, 6)) { } |
Quote:
|
All times are GMT. The time now is 04:43 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|