get_current_blog_id()

Description:

get_current_blog_id() -The name of the function is pretty self-explanatory.  It returns the id of the current blog. It is not especially useful for normal WordPress installations but it is very important if you`re developing a WordPress MU theme or plugin.

Parameters:

None

Basic usage:

echo get_current_blog_id();
//Returns 1(or whatever your blog_id is)

Get all published posts in the current blog in wordpress MU:

global $wpdb;
$blog_id = get_current_blog_id();
if($blog_id == 1)
{
$postsArr = $wpdb->get_results("SELECT * FROM wp_posts WHERE post_status='publish'");
print_r($postsArr);
}
else
{
$postsArr = $wpdb->get_results("SELECT * FROM wp_".$blog_id."_posts WHERE post_status='publish'");
print_r($postsArr);
}
//Returns an array of objects in the following format
Array
(
    [0] => stdClass Object
        (
            [ID] => 418
            [post_author] => 1
            [post_date] => 2012-09-20 10:18:53
            [post_date_gmt] => 2012-09-20 10:18:53
            [post_content] =>
            [post_title] => Your post title
            [post_excerpt] =>
            [post_status] => publish
            [comment_status] => closed
            [ping_status] => closed
            [post_password] =>
            [post_name] => Your post name
            [to_ping] =>
            [pinged] =>
            [post_modified] => 2012-09-20 10:28:33
            [post_modified_gmt] => 2012-09-20 10:28:33
            [post_content_filtered] =>
            [post_parent] => 0
            [guid] => http://yourdomain.net/?post_type=functions&p=1
            [menu_order] => 0
            [post_type] => functions
            [post_mime_type] =>
            [comment_count] => 0
        )

)