Raised This Month: $ Target: $400
 0% 

access() or get_user_flags()?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-08-2012 , 08:44   Re: access() or get_user_flags()?
Reply With Quote #7

PHP Code:
stock access(id,level
{
    if (
level==ADMIN_ADMIN)
    {
        return 
is_user_admin(id);
    }
    else if (
level==ADMIN_ALL)
    {
        return 
1;
    }

    return (
get_user_flags(id) & level);

access prevents coder from making mistakes with flags, because not all coders know usages of ADMIN_ADMIN and ADMIN_ALL, and also it handles better situations where the admin level is hold by a variable.

So :
If you check admin access in a command, use cmd_access
Else use access.
You may also need has_flag or has_all_flags in some situations.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
 



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 -4. The time now is 08:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode