I've created a theme that allows to aggregate all the blogs on a WPMU install and thought someone else might benefit from it...
Instructions:
1. Create a page called page-aggregator.php in your theme.
2. Change the following lines in the code:
define ('Host','localhost');
define ('User','Your DB Username');
define ('Password','Your DB Password');
define ('BlogDB','Your DB');
3. There is no step 3. You expected something more difficult?
and here's the code to put in your template....
wp_".$thisblognumber."_options
<?php
/*
Template Name: Aggregator
*/
get_header();?>
<div id="content">
<div id="content-main">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
define ('Host','localhost');
define ('User','Your DB Username');
define ('Password','Your DB Password');
define ('BlogDB','Your DB');
function thisblogname($thisblognumber)
{
$Blogname_Request = "SELECT * FROM WHERE
option_name LIKE CONVERT( _utf8 'blogname' USING latin1 ) COLLATE latin1_swedish_ci LIMIT 0 , 1";
".$table."
$BlogDB_Link = mysql_connect (Host,User,Password);
$myblogname = mysql_db_query (BlogDB, $Blogname_Request, $BlogDB_Link) or die("Couldn't open ".BlogDB.": ".mysql_error());;
mysql_close ($BlogDB_Link);
while ($newblogname = mysql_fetch_array ($myblogname))
{
$thisblogname = $newblogname[option_value];
}
return ($thisblogname);
}
function aggregate($table,$title)
{
print "<h2>".$title."</h2>";
$BlogDB_Request = "SELECT *
FROM
post_date
ORDER BY DESC
wp_blogs
LIMIT 0 , 5";
$BlogDB_Link = mysql_connect (Host,User,Password);
$posts = mysql_db_query (BlogDB, $BlogDB_Request, $BlogDB_Link) or die("Couldn't open ".BlogDB.": ".mysql_error());;
mysql_close ($BlogDB_Link);
while ($post = mysql_fetch_array ($posts))
{
$title = $post[post_title];
$url = "<a href="".$post[guid]."">";
print "".$url.$title."</a>
".chr(13);
}
}
$BlogID_Request = "SELECT *
FROM
wp_blogs
ORDER BY .
blog_id ASC
LIMIT 0 , 1000";
$BlogDB_Link = mysql_connect (Host,User,Password);
$blogID = mysql_db_query (BlogDB, $BlogID_Request, $BlogDB_Link) or die("Couldn't open ".BlogDB.": ".mysql_error());;
mysql_close ($BlogDB_Link);
while ($blogIDs = mysql_fetch_array ($blogID))
{
$thisblogID = $blogIDs[blog_id];
$blog = "wp_".$thisblogID."_posts";
$thisblogname = thisblogname($thisblogID);
aggregate($blog,$thisblogname);
// aggregate($blog,'');
}
?>
<?php endwhile; ?>
<p align="center"><?php posts_nav_link(' - ','« Prev','Next »') ?>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.
<?php endif; ?>
</div><!-- end id:content-main -->
<?php get_sidebar();?>
<?php get_footer();?>
Feel free to comment and add any features or tell me ways in which this could be improved :)