Many people have asked me how I embedded the available Lifestream plugins (or code) so that it looks like mine at h4×3d.com/lifestream
Many seem to struggle with the (yet) simple set-up or use the wrong (and buggy) files.
Since the Lifestream I use is a mixture of different Lifestream plugins and it is all open-source, I would like to lift some secrets and share my knowledge with you.
My resources include Jeremy Keith’s Lifestream plugin code (at the bottom), Elliot Back’s Lifestream code (that did not work correctly), this article, a blog dedicated to Lifestreams and last but not least Gunnar Þór Hafdal – the Lifestream godfather. I was lucky to pick-up his code. I removed some items here and there, but in general he did 99,9% of the work, thank you!. I wonder why he took down his Lifestream and the code samples? They were great.
Below you will find the code, please note that the Wordpress Plugin integration does not work, you will have to hand-code the variables such as FlickrRSS etc in the life.php itself.
NOTE: You need to run a quick CTRL+H (find and replace) for the < ?php… the code-markup on this page is that way so it does not break anything. You need to finalize the script yourself by changing all instances of < ?php back to the original (delete the blank space)
Life.php (goes in Theme folder)
'http://feeds.feedburner.com/Twitter/h4x3d',
'life_blog' => 'http://feeds.feedburner.com/jez',
'life_flickr' => 'http://api.flickr.com/services/feeds/photos_public.gne?id=29642584@N00&format=rss_200',
'life_delicious' => 'http://feeds.feedburner.com/Delicious/h4x3d?format=xml',
'life_lastfm' => 'http://ws.audioscrobbler.com/1.0/user/h4x3d/recenttracks.rss',
'life_digg' => 'http://digg.com/rss/jizz/index2.xml',
'life_cocomment' => 'http://www.cocomment.com/myrss2/jez.rss'
);
}
function checkStreams() {
if( get_option( 'life_installed' ) ) {
} else {
self::install();
}
}
function install() {
add_option( 'life_installed', '1', "" );
add_option( 'life_version', '1.0', "");
foreach ( self::defaultStreams() as $key => $value ) {
add_option( $key, $value, "" );
}
/* echo 'Installed, ready to go.' */;
}
function upgrade() {
foreach ( self::defaultStreams() as $key => $value ) {
if( !get_option( $key ) ) {
add_option( $key, $value, "" );
echo 'Added ' . $key;
}
}
}
function loadStreams() {
foreach( self::defaultStreams() as $key => $value ) {
// find the values for each of our streams (RSS Feeds)
if( get_option( $value ) ) {
$value = get_option( $value );
} else {
echo '
' . $key . ': ' . $value . ' not found in the database.
';
}
}
}
}
life::checkStreams();
?>
Another file
Stream.php (goes in Theme folder)
(legend of tags)
<a href="" rel="bookmark" title="Permanent Link to ">
< ?php the_content('
Continue reading this article'); ?>
$feed ) {
$rss = @fetch_rss( $feed );
$items = $rss->items = array_slice( $rss->items, 0 );
foreach ($items as $item ) {
$date = strtotime( substr( $item['pubdate'], 0, 25 ) );
// This fixes the time error that the "date_default_timezone_set" should fix
// Set it as $date += 3600*1; to add 1 hour or $date -= 3600*1; to remove 1 hour
// I think it's based around the UTC time
$date += 3600*2;
$list[ $date ][ "name" ] = $name;
foreach ($details as $detail) {
$list[$date]['title'] = $item['title'];
$list[$date]['link'] = $item['link'];
}
}
}
krsort( $list );
$day = '';
foreach ( $list as $timestamp => $item ) {
$this_day = date("F jS",$timestamp );
if ( $day != $this_day ) {
?>
<tr class="vevent ">
<img src="" alt="" />
<abbr title="">
(special code goes here, see below)*
Sorry, no posts matched your criteria.
*Special code, it breaks the display, type it down yourself in order to make it work. Don’t be lazy :)
1 <a class=”url summary” href=”< ?php echo $item["link"]; ?>”>< ?php echo $item["title"]; ?></a>
Again Credits go to Gunnar, he’s the man
If you enjoyed this post, make sure you subscribe to my RSS feed!

h4x3d.com does not host any illegal content. Links/Files referred to are for educational purposes only.




2
July 24, 20072:46 pm
July 24th, 2007 2:46 pm
XIII
Sjweet. I’m building mine using a seperate WP installation, so every item is stored as a blog entry. It’ll take a while longer to make it look nice but I hope it will make things more flexible in the long run.
4
July 24, 20073:37 pm
July 24th, 2007 3:37 pm
jez
hook me up with results once you are done, I am curious to see it :)
btw. just saw you are from the netherlands, wat leuk, dat is heel mooi, we kunnen ook nederlandse praaten
- off to ten day trip vacation, I will be answering all mails as soon as I am back!
6
July 30, 200711:51 am
July 30th, 2007 11:51 am
Bull3t
Okay, well this works a treat for me except the times (and sometimes the dates) that are shown are completely wrong, I Dugg a story (The Most Energy-Efficient Form of Travel Ever Devised) just now but my Lifestream (http://blog.bull3t.me.uk/about/lifestream) shows that I Dugg it yesterday at 19:45, when I didn’t. The times seem to be random and the dates don’t seem to be working correctly.
Any ideas?
8
August 1, 20072:37 pm
August 1st, 2007 2:37 pm
Bull3t
Hmm, I have just noticed that the feed that Digg supplies for each and every user does not have the date that the user dugg the article, but the date that the article was submitted, which is a little annoying. Thanks for the great tool though, very useful. See mine here: http://blog.bull3t.me.uk/about/lifestream/.
10
August 1, 20075:18 pm
August 1st, 2007 5:18 pm
Gray
works like a charm. needs some MODs for individual themes though.
12
August 3, 20078:18 pm
August 3rd, 2007 8:18 pm
jez
bull3t, I can confirm the digg problem and I have no idea why this is the case, however I believe it has something to do with the servertime given back by digg itself or the time digg issues the individual user’s RSS-Feed.
Gray, what do you mean?
14
August 3, 20078:51 pm
August 3rd, 2007 8:51 pm
Bull3t
Welcome back from your holiday, Jez, hope you had a nice time – I am going on holiday for a week tomorrow, can’t wait.
I sent a support ticket to Digg about this issue to which they do not seem to have replied as of yet, I will let you know of any updates.
16
August 3, 20078:55 pm
August 3rd, 2007 8:55 pm
jez
thanks and please let me know any information digg sends to you. enjoy your time off!