All blogs in one place, by alphabetical order

Hi guys,

Got some issues with php code in here.

I was searching for simple php code which will pull out from my database all new users which are registered in my multisite. So i found something but it’s not quite exactly what i was hoping for.

On the web site, stackexchange i found out little php script which does exactly what i was hoping for, just pulling all users from database with shordcode insite where can i paste it in post or page to see all registered users ever. There are two problems:

1. I have no idea how to remove one specific line of the code which is not in use anymore

this line is:

($bcount = get_blog_count();)

2. Is there a way to show this blogs in page/post by alphabetical order?

Here is the code im using:

function theme_list_all_network_sites()
global $wpdb;

$result = '';
$sites = array();
$blogs = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE spam = '0' AND deleted = '0' and archived = '0' and public='1'"));

foreach($blogs as $blog)
$details = get_blog_details($blog->blog_id);

if($details != false)
$url = $details->siteurl;
$name = $details->blogname;

if(!(($blog->blog_id == 1) && ($show_main != 1)))
$sites[$name] = $url;


$count = count($sites);
$current = 1;

foreach($sites as $name=>$url)
$result.= '<a href="'.$url.'">'.$name.'</a>';
$result.= ($current == $count) ? "n" : ' | ';


return $result;

add_shortcode('network_list', 'theme_list_all_network_sites');

and i have to add. Since this code has to be inserted in themes shortcode.php file, which i couldn’t find, i’ve used general shordcode file which i found in wp-includes folder.