Blellow Wordpess Group Message Display Widget

I created a widget to display the messages from the Wordpress Dev group on new site called Blellow. If you want to show messages from another group you can change the $group variable. You can display any number of messages you’d like by changing the $maxposts variable.

Blellow

Blellow

<?php
/*
Plugin Name: Blellow
Plugin URI: http://www.widgetifyr.com
Description: Blellow Group Tracker
Author: Glenn Bennett
Version: 1.0
Author URI: http://www.widgetifyr.com

*/

// We're putting the plugin's functions inside the init function to ensure the
// required Sidebar Widget functions are available.

function widget_blellowgroup_init()
{
/* Your custom code starts here */
/* ---------------------------- */

/* Your Function */
function blellowgroup()
{

/* Your Code ----------------- */

$group = "wordpress";
$maxposts = 5;
$url = "http://blellow.com/groups/$group/dashboard";
$xmlurl = "$url.xml";
$messages =  simplexml_load_file($xmlurl);

// Here we'll put a loop to include each item's title and description
$i=0;
echo "<ul>";
foreach ($messages as $item)
{
echo "<li>" . $item->body . "</li>";
$i++;
if($i == 5)
{
break;
}
}
echo "<li><a href=\"$url\">More updates...</a></li>";

echo "</ul>";

/* End of Your Code ---------- */

}

/* -------------------------- */
/* Your custom code ends here */

function widget_blellowgroup($args)
{

// Collect our widget's options, or define their defaults.
$options = get_option('widget_blellowgroup');
$title = empty($options['title']) ? __('Blellow Group Tracker') : $options['title'];

extract($args);
echo $before_widget;
echo $before_title;
echo $title;
echo $after_title;
blellowgroup();
echo $after_widget;
}

// This is the function that outputs the form to let users edit
// the widget's title. It's an optional feature, but were're doing
// it all for you so why not!

function widget_blellowgroup_control()
{

// Collect our widget options.
$options = $newoptions = get_option('widget_blellowgroup');

// This is for handing the control form submission.
if ( $_POST['widget_blellowgroup-submit'] )
{
// Clean up control form submission options
$newoptions['title'] = strip_tags(stripslashes($_POST['widget_blellowgroup-title']));
}

// If original widget options do not match control form
// submission options, update them.
if ( $options != $newoptions )
{
$options = $newoptions;
update_option('widget_blellowgroup', $options);
}

$title = attribute_escape($options['title']);

echo '<p><label for="blellowgroup-title">';
echo 'Title: <input style="width: 250px;" id="widget_blellowgroup-title" name="widget_blellowgroup-title" type="text" value="';
echo $title;
echo '" />';
echo '</label></p>';
echo '<input type="hidden" id="widget_blellowgroup-submit" name="widget_blellowgroup-submit" value="1" />';
}

// This registers the widget.
register_sidebar_widget('Blellow', 'widget_blellowgroup');

// This registers the (optional!) widget control form.
register_widget_control('Blellow', 'widget_blellowgroup_control');

}

add_action('plugins_loaded', 'widget_blellowgroup_init');

?>

I still need to figure out how to display the user name. The Bellow API lookes very much like a work in progress, but as they add new features I’ll be updating the widget.
Obviously I used our tool to create this widget and as our system gets impoved so will this widget.