Skip to Content.
Sympa Menu

lyceum-users - [Lyceum-users] List of blogs on a site

lyceum-users AT lists.ibiblio.org

Subject: Lyceum-users mailing list

List archive

Chronological Thread  
  • From: "David R. Woolley" <drwool AT thinkofit.com>
  • To: lyceum-users AT lists.ibiblio.org
  • Subject: [Lyceum-users] List of blogs on a site
  • Date: Fri, 22 Sep 2006 15:29:36 -0500

Unless I'm missing something, there doesn't seem to be anything in Lyceum that lists all of the blogs on a site with links to their home pages.  I wanted this capability, so I whipped up this quick & dirty blog list function, cribbing liberally from existing code in the system-admin directory.

To use it, paste this code into a new file in lyceum/system-admin. Call it something like bloglist.php. Then just call it up through your browser.

Here's the stuff:

<?php
require('system-config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Lyceum System Settings</title>
<link rel="stylesheet" href=""../wp-admin/wp-admin.css"" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p><a href=""settings.php">return" to Lyceum System Settings</a></p>
<hr/>
<?php
function generate_blog_list($type){
    global $wpdb;
    assert('deleted'==$type || 'active'==$type);
    $bloglist = $wpdb->get_col("SELECT `id` FROM `$wpdb->blogs` WHERE `status` = '$type'");
    $bloglist = implode(',',$bloglist);
    $blogs = $wpdb->get_results("
              SELECT `blog`, `option_value` AS `name`
              FROM $wpdb->options
              WHERE `option_name` = 'blogname'
              AND `blog` IN
                       ($bloglist)");
    if ($blogs) {
              echo "<h2>$type blogs</h2><ul>";
              foreach( $blogs as $currentblog ) {
                  $url = "$wpdb->get_var("SELECT" option_value FROM $wpdb->options WHERE blog='$currentblog->blog' AND option_name= 'home'");
                  echo "<li>$currentblog->blog: <a href="\"$url\">$currentblog->name</a>";               }
              echo '</ul>';
    }
    else
              echo "<H2>There are no $type blogs</option>";
}
?>

<table width=80%><tr valign=top><td>
<?php
    generate_blog_list ('active');
?>
</td><td>
<?php
    generate_blog_list ('deleted');
?>
</td></tr></table>
</body>
</html>


Archive powered by MHonArc 2.6.24.

Top of Page