WordPress.org

Make WordPress Core

Changeset 16050


Ignore:
Timestamp:
10/28/10 15:46:11 (6 years ago)
Author:
ryan
Message:

get_current_blog_id(). Props aaroncampbell. fixes #15233

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-app.php

    r15471 r16050  
    388388     */ 
    389389    function create_post() { 
    390         global $blog_id, $user_ID; 
     390        global $user_ID; 
    391391        $this->get_accepted_content_type($this->atom_content_types); 
    392392 
     
    420420            $this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.')); 
    421421 
    422         $blog_ID = (int ) $blog_id; 
     422        $blog_ID = get_current_blog_id(); 
    423423        $post_status = ($publish) ? 'publish' : 'draft'; 
    424424        $post_author = (int) $user_ID; 
  • trunk/wp-includes/admin-bar/admin-bar-class.php

    r16045 r16050  
    88 
    99    function initialize() { 
    10         global $blog_id; 
    11  
    1210        /* Only load super admin menu code if the logged in user is a super admin */ 
    1311        if ( is_super_admin() ) { 
     
    2927            $this->user->account_domain = $this->user->domain; 
    3028        } else { 
    31             $this->user->active_blog = $this->user->blogs[$blog_id]; 
     29            $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; 
    3230            $this->user->domain = trailingslashit( home_url() ); 
    3331            $this->user->account_domain = $this->user->domain; 
     
    8684        return $this->remove_node( $id, $this->menu ); 
    8785    } 
    88      
     86 
    8987    function render() { 
    9088        ?> 
  • trunk/wp-includes/general-template.php

    r15961 r16050  
    490490 
    491491    return $output; 
     492} 
     493 
     494/** 
     495 * Retrieve the current blog id 
     496 * 
     497 * @since 3.1.0 
     498 * 
     499 * @return int Blog id 
     500 */ 
     501function get_current_blog_id() { 
     502    global $blog_id; 
     503    return absint($blog_id); 
    492504} 
    493505 
  • trunk/wp-includes/post.php

    r15973 r16050  
    10171017 * - publish_posts - Controls publishing objects of this post type. 
    10181018 * - read_private_posts - Controls whether private objects can be read. 
    1019   
     1019 
    10201020 * These four primitive capabilities are checked in core in various locations. 
    10211021 * There are also seven other primitive capabilities which are not referenced 
     
    22662266        'suppress_filters' => true 
    22672267    ); 
    2268      
     2268 
    22692269    $r = wp_parse_args( $args, $defaults ); 
    22702270 
    22712271    $results = get_posts( $r ); 
    2272      
     2272 
    22732273    // Backward compatibility. Prior to 3.1 expected posts to be returned in array 
    22742274    if ( ARRAY_A == $output ){ 
     
    41424142 */ 
    41434143function _get_last_post_time( $timezone, $field ) { 
    4144     global $wpdb, $blog_id; 
     4144    global $wpdb; 
    41454145 
    41464146    if ( !in_array( $field, array( 'date', 'modified' ) ) ) 
     
    41534153    $post_types = apply_filters( "get_lastpost{$field}_post_types", (array) $post_types ); 
    41544154 
    4155     $key = "lastpost{$field}:$blog_id:$timezone:" . md5( serialize( $post_types ) ); 
     4155    $key = "lastpost{$field}:" . get_current_blog_id() . ":$timezone:" . md5( serialize( $post_types ) ); 
    41564156 
    41574157    $date = wp_cache_get( $key, 'timeinfo' ); 
  • trunk/wp-includes/user.php

    r16048 r16050  
    377377                'blog_id' => $GLOBALS['blog_id'], 
    378378                'role' => '', 
    379                 'meta_key' => '',  
     379                'meta_key' => '', 
    380380                'meta_value' => '', 
    381381                'meta_compare' => '', 
     
    573573 */ 
    574574function get_users_of_blog( $id = '' ) { 
    575     global $blog_id; 
    576  
    577575    if ( empty( $id ) ) 
    578         $id = (int) $blog_id; 
     576        $id = get_current_blog_id(); 
    579577 
    580578    return get_users( array( 'blog_id' => $id ) ); 
     
    594592 
    595593    if ( !is_multisite() ) { 
    596         global $blog_id; 
     594        $blog_id = get_current_blog_id(); 
    597595        $blogs = array(); 
    598596        $blogs[ $blog_id ]->userblog_id = $blog_id; 
     
    758756 */ 
    759757function count_users($strategy = 'time') { 
    760     global $wpdb, $blog_id, $wp_roles; 
     758    global $wpdb, $wp_roles; 
    761759 
    762760    // Initialize 
    763     $id = (int) $blog_id; 
     761    $id = get_current_blog_id(); 
    764762    $blog_prefix = $wpdb->get_blog_prefix($id); 
    765763    $result = array(); 
Note: See TracChangeset for help on using the changeset viewer.