Make WordPress Core

Ticket #16702: 16702.diff

File 16702.diff, 1.7 KB (added by solarissmoke, 14 years ago)
  • wp-includes/user.php

     
    715715}
    716716
    717717/**
    718  * Checks if the current user belong to a given blog.
    719  *
    720  * @since 3.0.0
    721  *
    722  * @param int $blog_id Blog ID
    723  * @return bool True if the current users belong to $blog_id, false if not.
    724  */
    725 function is_blog_user( $blog_id = 0 ) {
    726         global $wpdb;
    727 
    728         $current_user = wp_get_current_user();
    729         if ( !$blog_id )
    730                 $blog_id = $wpdb->blogid;
    731 
    732         $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';
    733 
    734         if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
    735                 return true;
    736 
    737         return false;
    738 }
    739 
    740 /**
    741718 * Add meta data field to a user.
    742719 *
    743720 * Post meta data is called "Custom Fields" on the Administration Panels.
  • wp-includes/deprecated.php

     
    26022602        return true;
    26032603}
    26042604
     2605/**
     2606 * Checks if the current user belong to a given blog. No longer used in core.
     2607 *
     2608 * @since MU
     2609 * @deprecated 3.2
     2610 *
     2611 * @param int $blog_id Blog ID
     2612 * @return bool True if the current user belongs to $blog_id, false if not.
     2613 */
     2614function is_blog_user( $blog_id = 0 ) {
     2615        _deprecated_function( __FUNCTION__, '3.2' );
     2616       
     2617        global $wpdb;
     2618
     2619        $current_user = wp_get_current_user();
     2620       
     2621        if ( !$blog_id )
     2622                $blog_id = $wpdb->blogid;
     2623
     2624        $cap_key = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
     2625       
     2626        if ( is_array( $current_user->$cap_key ) && in_array( 1, $current_user->$cap_key ) )
     2627                return true;
     2628
     2629        return false;
     2630}
     2631