WordPress Plugin Support Aggregator

Posted on

By Michael Fields

I make plugins for WordPress and I make it a point to host as many of them as possible in the Official WordPress Plugin Directory. I also like to support my plugins and prefer to do so at the WordPress Support Forums. Unfortunately, there is no easy way to see if someone has posted a new question except for clicking on all of the plugin pages and scrolling down to the “See what others are saying…” section on the right-hand sidebar. While I wish that these two sections of WordPress.org were better integrated this is currently not the case. For the time being, I came up with a solution that I would like to share with you.

Mad Props to the Following…

The following solution was created gluing together two tutorials that I have read. The first is an easy to follow article by Jeff Star on Perisable Press titled How to Import and Display RSS Feeds in WordPress. Jeff walks us through using the SimplePie class. The second tutorial was written by Devin Price and focuses on controlling what is displayed on the WordPress Dashboard and is titled Dashboard Support Widgets.

My goal was to combine these two tutorials into a custom solution where I would create a custom Dashboard Widget that displayed the 10 latest support questions for all of my plugins hosted on WordPress.org.

Create a Cache Directory

The first step is to create a cache directory on the server where WordPress is installed. In this example, I have created a directory named “wordpress-plugin-support-cache” directly under /wp-content/. You will want to set the new directory’s file permissions to 755.

Getting the Feeds

Fortunately, the Plugin Directory provides us with a public RSS feed for each plugin’s support section. The first step in finding the feed is to navigate to the plugins main page in the directory and click on the “Forum Posts” link.

You will want to click on the little orange RSS Feed icon to the right of “Forum Posts”. This will take you directly to the feed. Clicking on the text “Forum Posts” will bring you to a tag archive for support forums.

Save Some Time!

You do not need to follow the above process every single plugin that you have. Once you have one feed all you really need to do is modify the unique identifier in the url. Here’s the url for the support feed for my Taxonomy Images Plugin:

http://wordpress.org/support/rss/tags/taxonomy-images

The unique identifier here is “taxonomy-images” which is basically the title of the plugin in lowercase with spaces replaced by dashes. Here are all the links to my plugins hosted on Wordress.org:

http://wordpress.org/support/rss/tags/category-radio-buttons

http://wordpress.org/support/rss/tags/taxonomy-widget


http://wordpress.org/support/rss/tags/taxonomy-list-shortcode


http://wordpress.org/support/rss/tags/taxonomy-images


http://wordpress.org/support/rss/tags/taxonomy-terms-list


http://wordpress.org/support/rss/tags/bulk-image-resize-utility

Creating the Widget

if( !function_exists( 'mfields_dashboard_widget_plugin_support_aggregator' ) ) {
	function mfields_dashboard_widget_plugin_support_aggregator() {
		$feed_urls = array(
			'http://wordpress.org/support/rss/tags/category-radio-buttons',
			'http://wordpress.org/support/rss/tags/taxonomy-widget',
			'http://wordpress.org/support/rss/tags/taxonomy-list-shortcode',
			'http://wordpress.org/support/rss/tags/taxonomy-images',
			'http://wordpress.org/support/rss/tags/taxonomy-terms-list',
			'http://wordpress.org/support/rss/tags/bulk-image-resize-utility',
			);
		
		include_once ABSPATH . WPINC . '/class-simplepie.php';
		$feed = new SimplePie();
		$feed->set_feed_url( $feed_urls );
		$feed->set_cache_location( WP_CONTENT_DIR . '/wordpress-plugin-support-cache/' );
		$feed->set_cache_duration( 999 );
		$feed->handle_content_type();
		$check = $feed->init();
		
		if ( $check ) {
			print "\n\t" . '<ul>';
			foreach ( $feed->get_items( 0, 10 ) as $item ) {
				$blog = '';
				$href = $item->get_permalink();
				$title = $item->get_title();
				
				print "\n\t" . '<li><a href="' . $href . '">' . $title . '</a></li>';
			}
			print "\n\t" . '</ul>';
		}
		else {
			print "\n\t" . '<h2>Feeds currently not available</h2>';
			print "\n\t" . '<p>Please try again later</p>';
		}
	}
}

This function is based of the knowledge that I gained from the SimplePie article on Perisable Press. You will want to replace my feed urls with you own in the $feed_urls array.

Register the Dashboard Widget

if( !function_exists( 'mfields_dashboard_widget_plugin_support_aggregator_init' ) ) {
	add_action('wp_dashboard_setup', 'mfields_dashboard_widget_plugin_support_aggregator_init');
	function mfields_dashboard_widget_plugin_support_aggregator_init() {
		wp_add_dashboard_widget( 
			'mfields_dashboard_widget_plugin_support_aggregator', 
			'WordPress Plugin Support', 
			'mfields_dashboard_widget_plugin_support_aggregator'
			);
	}
}

This function was derived from the code that I found in Devin’s article. If you would like to change the title on the widget please modify the second argument passed to the wp_add_dashboard_widget() function.

That’s Really All There is to It!

You can copy and paste the following two functions into you theme’s functions.php or use them in a custom plugin.

6 Comments Comments are closed

  1. Devin May 29, 2010 at 6:56 pm

    Hi Mike. I’ll have to look at how the caching was of the feeds was done and update my post.

    It seems like this would be a very useful as a generic rss dashboard plug-in, i.e. if there was a settings page for the widget so we could just paste in whatever feed we wanted to appear on the dashboard rather than the user having to edit the code.

    Thanks for the thorough tutorial.

  2. Michael Fields May 29, 2010 at 9:16 pm

    No problem. Something based on this code could serve well in creating a generic RSS widget for both the dashboard as well as the theme. I think I’ll stick to fine tuning the plugins that I already have made though.

  3. scribu June 16, 2010 at 9:46 pm

    I have a lazier approach, using Yahoo Pipes. :)

  4. Chip Bennett June 18, 2011 at 3:45 am

    And now, there’s an even easier method:
    http://wordpress.org/support/view/plugin-committer/mfields

    Just grab the feed for the page:
    http://wordpress.org/support/rss/view/plugin-committer/mfields

    Put it in your dashboard, put it in your aggregator of choice, or whatever. :)

  5. Michael Fields June 18, 2011 at 4:24 am

    Good point Chip! I found about about these recently. Definately a nice addition to wordpress.org … You still have to glue this with your theme support feeds for total coverage though right? maybe we’ll get a /theme-author/mfields feed soon :)

  6. Chip Bennett June 18, 2011 at 1:25 pm

    As far as I know, that’s true, Michael. Though, I see no reason that, eventually, there couldn’t be one, unified feed. I’ll have to look into the feasibility of that – or, at least, of getting a theme-contributor support feed in the meantime.

Fork me on GitHub