<?php /* Plugin Name: Random Blog Plugin URI: http://tdjc.be/2006/09/06/random-blog-plugin-for-wpmu/ Description: Creates a static link to a random blog Version: 1.0 Author: Dr. Mike Wendell Author URI: http://tdjc.be Install instructions 1) Place this file (ie next.php) into your WPMU root 2) Add a link to http://mydomain.tld/next.php to where ever you want it. 3) Click on the link. You should go to a random public blog on your site. :) I would recommend putting this link within your Admin Bar if you use that plugin. Assumptions: Your main blog has the blog_id of '1'. That should be a given with WPMU but if it's not, modify the $sql statement. Also I'm assuming that the name of your _blogs table is wp_blogs. If not, then you need to change that as well. */ include('wp-config.php'); $values = array(); $sql="SELECT * FROM wp_blogs WHERE (public = '1' AND mature = '0' AND spam = '0' AND deleted = '0' AND blog_id != '1')"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $randomdomain = $row['domain']; $randompath = $row['path']; $randomurl = 'http://' . $randomdomain . $randompath; array_push($values, "$randomurl"); } shuffle($values); $rand_keys = array_rand($values, 2); $randomblog = $values[$rand_keys[0]]; ?> <html><head> <META HTTP-EQUIV=Refresh CONTENT="3; URL=<?php echo $randomblog; ?>"> </head><body> </body></html>