Changeset 722

Show
Ignore:
Timestamp:
02/23/07 23:04:22 (2 years ago)
Author:
mdawaffe
Message:

bb_is_trusted_user(). Fixes #599

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bb-includes/akismet.php

    r707 r722  
    5252                        return; 
    5353                $user = bb_get_user( $bb_post->poster_id ); 
     54                if ( bb_is_trusted_user( $user->ID ) ) 
     55                        return; 
    5456 
    5557                $_submit = array( 
     
    7274                if ( !$user ) 
    7375                        return; 
     76                if ( bb_is_trusted_user( $user->ID ) ) 
     77                        return; 
    7478 
    7579                $_submit = array( 
     
    8589                break; 
    8690        default : 
     91                if ( bb_is_trusted_user( bb_get_current_user() ) ) 
     92                        return; 
     93 
    8794                $path = '/1.1/comment-check'; 
    8895 
  • trunk/bb-includes/functions.php

    r720 r722  
    19331933} 
    19341934 
     1935function bb_is_trusted_user( $user ) { // ID, user_login, BB_User, DB user obj 
     1936        if ( is_numeric($user) || is_string($user) ) 
     1937                $user = new BB_User( $user ); 
     1938        elseif ( is_object($user) && is_a($user, 'BB_User') ); // Intentional 
     1939        elseif ( is_object($user) && isset($user->ID) && isset($user->user_login) ) // Make sure it's actually a user object 
     1940                $user = new BB_User( $user->ID ); 
     1941        else 
     1942                return; 
     1943 
     1944        if ( !$user->ID ) 
     1945                return; 
     1946 
     1947        return apply_filters( 'bb_is_trusted_user', (bool) array_intersect(bb_trusted_roles(), $user->roles), $user->ID ); 
     1948} 
     1949 
    19351950function bb_get_active_theme_folder() { 
    19361951        $activetheme = bb_get_option( 'bb_active_theme' );