<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: New Plugin: MU-Helpers</title>
	<atom:link href="http://xentek.net/media/783/new-plugin-mu-helpers/feed/" rel="self" type="application/rss+xml" />
	<link>http://xentek.net/media/783/new-plugin-mu-helpers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-plugin-mu-helpers</link>
	<description></description>
	<lastBuildDate>Sat, 05 May 2012 21:49:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19827</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: WordPress Plugin Releases for 06/18 &#124; Tolly Blog</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1794</link>
		<dc:creator>WordPress Plugin Releases for 06/18 &#124; Tolly Blog</dc:creator>
		<pubDate>Fri, 09 Jul 2010 03:09:04 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1794</guid>
		<description>[...] WordPress-MU Helpers [...] </description>
		<content:encoded><![CDATA[<p>[...] WordPress-MU Helpers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Marden</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1793</link>
		<dc:creator>Eric Marden</dc:creator>
		<pubDate>Tue, 15 Jun 2010 01:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1793</guid>
		<description>Stephanie, 

Thanks for the contribution! I&#039;ll probably clean this up and include it in a future update.

~e</description>
		<content:encoded><![CDATA[<p>Stephanie, </p>
<p>Thanks for the contribution! I&#8217;ll probably clean this up and include it in a future update.</p>
<p>~e</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephanie Leary</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1792</link>
		<dc:creator>Stephanie Leary</dc:creator>
		<pubDate>Tue, 15 Jun 2010 01:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1792</guid>
		<description>This is a great plugin! I just hacked get_all_blog_posts() a bit for a friend so she can grab the blog ID, title, and URL right from the post objects. (I&#039;m sure you could get all that later using just the ID, but for her purposes, this was much easier.)

&lt;code&gt;
function get_all_blog_posts( $num_per_blog = 1, $orderby = &#039;date&#039;, $sort = &#039;post_date_gmt&#039; )
{
	$posts = array();
	$blogs = get_blog_list( 0,&#039;all&#039; );
	foreach ( $blogs as $blog ):
		switch_to_blog($blog[&#039;blog_id&#039;]);
			$newposts = get_posts(&#039;orderby=&#039;.$orderby.&#039;&amp;numberposts=&#039;.$num_per_blog);
			foreach ($newposts as $postobj) {
				$postobj-&gt;blog_id = $blog[&#039;blog_id&#039;];
				$postobj-&gt;blog_name = get_bloginfo(&#039;name&#039;);
				$postobj-&gt;blog_url = get_bloginfo(&#039;url&#039;);				
			}
			$posts = array_merge( $posts, $newposts );	
		restore_current_blog();
	endforeach;
	
	return _quicksort( $posts, $sort );
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This is a great plugin! I just hacked get_all_blog_posts() a bit for a friend so she can grab the blog ID, title, and URL right from the post objects. (I&#8217;m sure you could get all that later using just the ID, but for her purposes, this was much easier.)</p>
<p><code><br />
function get_all_blog_posts( $num_per_blog = 1, $orderby = 'date', $sort = 'post_date_gmt' )<br />
{<br />
	$posts = array();<br />
	$blogs = get_blog_list( 0,'all' );<br />
	foreach ( $blogs as $blog ):<br />
		switch_to_blog($blog['blog_id']);<br />
			$newposts = get_posts('orderby='.$orderby.'&amp;numberposts='.$num_per_blog);<br />
			foreach ($newposts as $postobj) {<br />
				$postobj-&gt;blog_id = $blog['blog_id'];<br />
				$postobj-&gt;blog_name = get_bloginfo('name');<br />
				$postobj-&gt;blog_url = get_bloginfo('url');<br />
			}<br />
			$posts = array_merge( $posts, $newposts );<br />
		restore_current_blog();<br />
	endforeach;</p>
<p>	return _quicksort( $posts, $sort );<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Marden</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1791</link>
		<dc:creator>Eric Marden</dc:creator>
		<pubDate>Mon, 14 Jun 2010 17:41:46 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1791</guid>
		<description>You&#039;d basically replace the entire loop with this. I wrote these for a couple of widgets, so I was looping over the results directly.

&lt;code&gt;
$posts = get_all_blog_posts();
foeach ($posts as $post):
echo $post-&gt;post_title;
endforeach;
&lt;/code&gt;

The template tags may or may not work inside the foreach loop shown here. I haven&#039;t tested.</description>
		<content:encoded><![CDATA[<p>You&#8217;d basically replace the entire loop with this. I wrote these for a couple of widgets, so I was looping over the results directly.</p>
<p><code><br />
$posts = get_all_blog_posts();<br />
foeach ($posts as $post):<br />
echo $post->post_title;<br />
endforeach;<br />
</code></p>
<p>The template tags may or may not work inside the foreach loop shown here. I haven&#8217;t tested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Sweeney</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1790</link>
		<dc:creator>David Sweeney</dc:creator>
		<pubDate>Sat, 12 Jun 2010 04:58:44 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1790</guid>
		<description>What I mean is, can you give an example of an index.php page that uses the function?</description>
		<content:encoded><![CDATA[<p>What I mean is, can you give an example of an index.php page that uses the function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Sweeney</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1789</link>
		<dc:creator>David Sweeney</dc:creator>
		<pubDate>Sat, 12 Jun 2010 04:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1789</guid>
		<description>So in the loop, which function would I replace with the get_all_blog_posts function?</description>
		<content:encoded><![CDATA[<p>So in the loop, which function would I replace with the get_all_blog_posts function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Marden</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1788</link>
		<dc:creator>Eric Marden</dc:creator>
		<pubDate>Thu, 10 Jun 2010 21:54:41 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1788</guid>
		<description>Depends on the loop. Both MU-Helper functions loop over a list of blog IDs, and use switch_to_blog/get_posts to query for each blog&#039;s posts. I used a quicksort algorithm to mash them together in an ordered list. You can take the same approach here. Just limit your queries, and pull back only what you need to keep the process manageable. If you are caching queries (at the mysql level) and caching your results, you can optimize it even further.</description>
		<content:encoded><![CDATA[<p>Depends on the loop. Both MU-Helper functions loop over a list of blog IDs, and use switch_to_blog/get_posts to query for each blog&#8217;s posts. I used a quicksort algorithm to mash them together in an ordered list. You can take the same approach here. Just limit your queries, and pull back only what you need to keep the process manageable. If you are caching queries (at the mysql level) and caching your results, you can optimize it even further.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Marden</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1787</link>
		<dc:creator>Eric Marden</dc:creator>
		<pubDate>Thu, 10 Jun 2010 20:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1787</guid>
		<description>The way it works is that each blog is queried for the number of posts required, and then merged into one array of posts. The quicksort algorithm is then applied to the array so that the list of posts are sorted correctly. There is one efficient query per blog, but it only pulls in what you need (i.e. limited to just &lt;em&gt;N&lt;/em&gt; posts) and shouldn&#039;t be very expensive (even for a large number of blogs). The quicksort was used to avoid complex UNIONS and other MySQL nonsense that would have made getting this data use a lot more resources than it was worth.</description>
		<content:encoded><![CDATA[<p>The way it works is that each blog is queried for the number of posts required, and then merged into one array of posts. The quicksort algorithm is then applied to the array so that the list of posts are sorted correctly. There is one efficient query per blog, but it only pulls in what you need (i.e. limited to just <em>N</em> posts) and shouldn&#8217;t be very expensive (even for a large number of blogs). The quicksort was used to avoid complex UNIONS and other MySQL nonsense that would have made getting this data use a lot more resources than it was worth.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tyler</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1786</link>
		<dc:creator>tyler</dc:creator>
		<pubDate>Thu, 10 Jun 2010 20:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1786</guid>
		<description>Pulling RSS feeds will be less efficient than using switch_to_blog? Everything I&#039;ve read seems to imply using switch_to_blog in a loop will devour resources.

I suppose I&#039;ll just use switch_to_blog if you think that&#039;d be the best route.

Thanks again Eric!</description>
		<content:encoded><![CDATA[<p>Pulling RSS feeds will be less efficient than using switch_to_blog? Everything I&#8217;ve read seems to imply using switch_to_blog in a loop will devour resources.</p>
<p>I suppose I&#8217;ll just use switch_to_blog if you think that&#8217;d be the best route.</p>
<p>Thanks again Eric!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Sweeney</title>
		<link>http://xentek.net/media/783/new-plugin-mu-helpers/#comment-1785</link>
		<dc:creator>David Sweeney</dc:creator>
		<pubDate>Thu, 10 Jun 2010 20:04:41 +0000</pubDate>
		<guid isPermaLink="false">http://xentek.net/?p=783#comment-1785</guid>
		<description>If you specify a number to retrieve, I&#039;m assuming that the function does NOT retrieve the entire array of posts first, correct?</description>
		<content:encoded><![CDATA[<p>If you specify a number to retrieve, I&#8217;m assuming that the function does NOT retrieve the entire array of posts first, correct?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

