Back to vBulletin 3.0 Add-Ons

is_member_of improvement.
Mod Version: 1.00, by merk

This modification is in the archives.
vB Version: 3.0.0 Rating: (0 vote - 0 average) Installs: 9
Released: 04 Feb 2004 Last Update: Never Downloads: 1
Not Supported  

Requested by Boofo

Some people want to check for multiple groups at once, instead of having to slam OR is_member_of(anothercheck) together for each group, if you apply this hack it will be simple to check for multiple groups.

The format for the function is now,

Code:
is_member_of($bbuserinfo, ID1, ID2, ID3,.....);
Just seperate each group by a comma, no need for extra quotes or anything.

Find the function in includes/functions.php ~line 190 and replace it with the following.

This should not affect any current is_member_of conditionals you're using.

PHP Code:
function is_member_of()
{
    static 
$argpad$user_memberships;

    
$usergroupids func_get_args();
    
$userinfo array_shift($usergroupids);
    
    
// check primary usergroup against given usergroupids
    
if(in_array($userinfo['usergroupid'], $usergroupids))
    {
        return 
true;
    }
    
    
// if we dont already have membergroupids, fetch them.
    
if(!is_array($user_memberships["$userinfo[userid]"]))
    {
        
$user_memberships["$userinfo[userid]"] = fetch_membergroupids_array($userinfo);    
    }
    
    foreach(
$usergroupids as $usergroupid)
    {
        if(
in_array($usergroupid$user_memberships["$userinfo[userid]"]))
        {
            return 
true;
        }
    }
    
    return 
false;

Download

No files for download.

Similar Mods

[Improvement] vBStats -> Top Posters list PHP-code improvement (much less queries) vBulletin 2.x Full Releases
[Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries vBulletin 2.x Full Releases

vblts.ru supports vBulletin®, 2022-2024