One of the many requests is changing your lifestream output to something other than what the widget can provide. I do this on my personal site, and there are also several other people doing this. However, there was/is no real documentation or guide for it.
So, we're going to give you a quick rundown. Keep in mind, this requires writing PHP code.
Lifestream wraps all of its events, and its groups of events in to several classes. There's one common function call which will return instances of these classes:
function lifestream_get_events($_=array())
{
$defaults = array(
// number of events
'number_of_results' => get_option('lifestream_number_of_items'),
// offset of events (e.g. pagination)
'offset' => 0,
// array of feed ids
'feed_ids' => array(),
// array of user ids
'user_ids' => array(),
// array of feed type identifiers
'feed_types' => array(),
// interval for date cutoff (see mysql INTERVAL)
'date_interval' => get_option('lifestream_date_interval'),
// start date of events
'start_date' => -1,
// end date
'end_date' => -1,
// minimum number of events in group
'event_total_min' => -1,
// maximum
'event_total_max' => -1,
// break groups into single events
'break_groups' => false,
);
}
Now, the way this works is pretty simple:
// this will return results 20-40 from your lifestream, perfect for pagination
$results = lifestream_get_events(array(
'offset' = 20,
'number_of_results' = 20,
'date_interval' = -1,
));
Let's take a look at what lifestream_twitter_status() does:
// this is a shortcut method which the twitter event handler returns
function lifestream_get_single_event($feed_type)
{
$events = lifestream_get_events(array('feed_types'=>array($feed_type), 'number_of_results'=>1, 'break_groups'=>true));
$event = $events[0];
return $event;
}
/**
* Displays your latest Twitter status.
* @param {Boolean} $links Parse user links.
*/
function lifestream_twitter_status($links=true)
{
$event = lifestream_get_single_event('twitter');
if (!$event) return;
if ($links)
{
// to render it with links
echo $event->feed->render_item($event, $event->data);
}
else
{
// or render just the text
echo $event->data['title'];
}
}
As you can see all of the internal methods are calling one global function, and that is the lifestream_get_events. It has a number of defaults, which typically are set within your options, but you can override any option by passing it into the initial array.
There's one more important option to talk about, and that's the break_groups option. If you set this to true, instead of getting a LifeStream_EventGroup instance, you're going to get a LifeStream_Event instance. This allows you to show every single event, even if it was within a batch, in the order it happened. Both of these classes function very similar, and have render methods on them.
I will eventually write up more documentation for this, but hopefully this is enough to get some of you started.