I have script in my functions.php that seeks to locate the media directory of the site in which the theme is installed. This is pretty simple unless the site is an MU site. In that case, the media directory is based on the blog_id.
However, my code below is returning the main site id rather than the blog_id of the site in which its being run…
function get_image_list()
{
global $current_site;
$dir=is_multisite() ? 'wp-content/blogs.dir/'.$current_site->blog_id.'/files/' : 'wp-content/uploads/';
$url=is_multisite() ? get_bloginfo('url').'/wp-content/blogs.dir/'.$current_site->blog_id.'/files/' : get_bloginfo('url').'/wp-content/uploads/';
In this case, the actual blog_id is 3, however, its returning a value of 1 for $current_site->blog_id
The error is…
cannot open wp-content/blogs.dir/1/files/