Skip to Content.
Sympa Menu

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

lyceum-users AT lists.ibiblio.org

Subject: Lyceum-users mailing list

List archive

Chronological Thread  
  • From: John Joseph Bachir <jjb AT ibiblio.org>
  • To: "David R. Woolley" <drwool AT thinkofit.com>
  • Cc: lyceum-users AT lists.ibiblio.org
  • Subject: Re: [Lyceum-users] List of blogs on a site
  • Date: Mon, 25 Sep 2006 01:11:28 -0400 (EDT)

david--

thanks for the code! do you realize that there is already code to do this in portal.php?

anyway it's nice to make it a function so people can use it in arbitrary places. ... wanna submit this idea and code in a ticket?

http://wiki.lyceum.ibiblio.org/index.php/Trac_Guide

thanks!


On Fri, 22 Sep 2006, David R. Woolley wrote:

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>

--
John
----
aim/yim/msn/jabber.org: johnjosephbachir
713.494.2704
irc://irc.freenode.net/lyceum
http://lyceum.ibiblio.org/
http://blog.johnjosephbachir.org/_______________________________________________
Lyceum-users mailing list
Lyceum-users AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/lyceum-users



Archive powered by MHonArc 2.6.24.

Top of Page