<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eric Juden &#187; wordpress mu</title>
	<atom:link href="http://thejudens.com/eric/tag/wordpress-mu/feed/" rel="self" type="application/rss+xml" />
	<link>http://thejudens.com/eric</link>
	<description>Web Application Developer, Husband and Father</description>
	<lastBuildDate>Wed, 01 Sep 2010 20:11:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress MU List Blogs</title>
		<link>http://thejudens.com/eric/2009/08/wordpress-mu-list-blogs/</link>
		<comments>http://thejudens.com/eric/2009/08/wordpress-mu-list-blogs/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 21:22:37 +0000</pubDate>
		<dc:creator>Eric Juden</dc:creator>
				<category><![CDATA[In the Trenches]]></category>
		<category><![CDATA[list blogs]]></category>
		<category><![CDATA[wordpress mu]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://thejudens.com/eric/?p=233</guid>
		<description><![CDATA[I recently had to make a list of all the active blogs for the university&#8217;s blog site running WordPress MU. Here&#8217;s the code to do so: &#60;?php if(is_front_page()){?&#62; &#60;h1&#62;Blog Directory&#60;/h1&#62; &#160; &#60;?php global $wpdb; $query = &#34;SELECT blog_id FROM &#34; . $wpdb-&#62;base_prefix . &#34;blogs WHERE spam != '1' AND archived != '1' AND deleted != [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to make a list of all the active blogs for the university&#8217;s blog site running <a href="http://mu.wordpress.org" target="_blank">WordPress MU</a>. Here&#8217;s the code to do so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">&lt;?php if(is_front_page()){?&gt;
</span>    <span style="color: #339933;">&lt;</span>h1<span style="color: #339933;">&gt;</span>Blog Directory<span style="color: #339933;">&lt;/</span>h1<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">&lt;?php
</span>    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT blog_id FROM &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-</span><span style="color: #666666; font-style: italic;">&gt;base_prefix . &quot;blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' AND blog_id != '1' ORDER BY path&quot;;
</span>    
    <span style="color: #000088;">$blogs</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-</span><span style="color: #666666; font-style: italic;">&gt;get_results($query);
</span>    
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$blogs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$blog</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$blog_details</span> <span style="color: #339933;">=</span> get_blog_details<span style="color: #009900;">&#40;</span><span style="color: #000088;">$blog</span><span style="color: #339933;">-</span><span style="color: #666666; font-style: italic;">&gt;blog_id);
</span>        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$blog_details</span><span style="color: #339933;">-</span><span style="color: #666666; font-style: italic;">&gt;siteurl .'&quot;&gt;' . $blog_details-&gt;blogname .'&lt;/a&gt;&lt;/li&gt;';
</span>    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">?&gt;</span></pre></div></div>

<p>You&#8217;ll notice the query is set to filter out blogs that are marked as archived, spam, private. Also, it hides the main blog from the list.</p>
]]></content:encoded>
			<wfw:commentRss>http://thejudens.com/eric/2009/08/wordpress-mu-list-blogs/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
