Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
is_member_of improvement. Details »»
is_member_of improvement.
Version: 1.00, by merk merk is offline
Developer Last Online: Mar 2012 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 02-03-2004 Last Update: Never Installs: 9
 
No support by the author.

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;

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 12-12-2004, 04:44 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mcyates
replaced it all and i got this:

Code:
Fatal error: Cannot redeclare is_member_of() (previously declared in /usr/home/yates238/public_html/includes/functions.php:176) in /usr/home/yates238/public_html/includes/functions.php on line 208
Then you didn't replace it all. Go back and make sure you got the whole function.
Reply With Quote
  #13  
Old 12-12-2004, 04:54 PM
mcyates mcyates is offline
 
Join Date: Jan 2003
Location: Middlesbrough, Cleveland
Posts: 798
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by amykhar
Then you didn't replace it all. Go back and make sure you got the whole function.

LeeCHeSSS script worked, but the orignal one didn't. I'll try your hack now. Thanks for the support.
Reply With Quote
  #14  
Old 12-27-2004, 10:54 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A template only mod to do this is available here if you would like to avoid editing php files.

http://www.vbulletintemplates.com/mo...ead.php?t=7570
Reply With Quote
  #15  
Old 07-30-2005, 02:28 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has this been added to 3.5 RC 1?
Reply With Quote
  #16  
Old 07-30-2005, 03:06 AM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's built in. Go read the code and you'll see that Jelsoft was wise and merciful and no hack is needed any more.
Reply With Quote
  #17  
Old 07-30-2005, 05:13 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great! Then we can still use it in templates the way Merk descibed, now, right?
Reply With Quote
  #18  
Old 07-30-2005, 01:59 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep. But, slightly changed:

Code:
<if condition="is_member_of($vbulletin->userinfo,6,5)">
Hello World!
</if>
Reply With Quote
  #19  
Old 07-30-2005, 03:01 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$bbuserinfo should still work in templates shouldn't it ?
Reply With Quote
  #20  
Old 07-30-2005, 03:34 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
$bbuserinfo should still work in templates shouldn't it ?
Yes. But, I try to upgrade to the new style when adding new conditionals.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:21 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09553 seconds
  • Memory Usage 2,299KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete