LINICKX LifeStream V0.2

Screen-shot of config screen

Screen-shot of config screen

UPDATE: This Plugin has been updated, the below links to the new file, but please comment on the new post, thanks.

Version 0.2 is the first feature update to my LINICKX Lifestream plug-in. This version incorporates all the minor bug fixes from version 0.1 -> 0.1.3 and includes what I call my “Troubleshooting Feature Pack”.

Version 0.1.x was plagued by a hidden multi-post issue, so not only is this fixed in V0.2, but I’ve included the tools used by myself to fix the issue. If you’ve been effected by this, use the factory reset option to clear out the lifestream plug-in, the next time it runs new posts will be created of all your feeds… so yes you will get double posts… but that will then be the last time it happens! :)

Plug-in Features:

  • Admin Feature Pack (NEW)
    Verbose Cron Mode, now you can see what the plug-in is doing!
    View the contents of the Lifestream Feed DB
    View the URLS, Tags & Categories stored in the plugin
    Factory Reset, remove all the settings without having to uninstall -> re-install
  • Stream Any Feed.
    Most internet services like digg, twitter, lastfm and the like support RSS feeds of your activity, so you can stream any service even if I haven’t heard about it yet!
  • Posts are created from the feeds/stream.
    Each Feed item creates a new post, you can tag & categorise your posts to give each stream a different look & feel in your WordPress templates.
  • No dependencies.
    LINICKX LifeStream uses WordPress functions to do it’s work, so yes it’ll work on PHP4 & PHP5 and you don’t need to update simplepie or an-other dependancy.
  • Flexible updating.
    By default LINICKX LifeStream should just work, WordPress will fetch the feeds every 5 minutes and store them in the WP Database, but you can change that. If you want to cron your updates every 1 minute you can, if you want the DB store in a file not in MySQL that’s not a problem either.

Bug Fixes

  • Version 0.2 Multi-Post issue – http://wordpress.org/support/topic/330243
  • Pushed Version 0.1.3 more bug fixes; 0.1.2 broke auto updates, so 0.1.3 fixes it again!
    linickx.com was having execution timeout issues, so theres a patch to fix that for other users
    I’ve also introduced a config.php so that upgrades do not overwrite $WPDIR set by users.
  • Pushed version 0.1.2 to fix error in dashboard reported by Markus .
  • Pushed version 0.1.1 as the directory path changed when wordpress.org created their .zip file… all should be working again.

Right now on LINICKX.com this plugin is streaming Digg, Google Reader and WordPress Commits… keep an eye for new things streamed such as delicious & last fm :cool:

I’m still looking for help.
If you think you can javascript/ajax the admin interface, or my plug-in WordPress MU compatible, please let me know.

Disclaimer
Plug-in development is a hobby, I have a full time job that takes priority. Feel free to leave comments on this post but ask support questions to the WordPress community. I will update this plugin as and when I need features to improve linickx.com and will consider any patches submitted including any good ideas you have.

If you use this plug-in, please consider donating as I give this code away for free and giving something back is good for your kama :cool:

Version 0.1.3

I’m learning a lot with this plug-in development, it seems to be a lot more difficult than stuff I’ve done in the past.

In just a few days I’ve had to push out 3 bug fix releases! 0.1.3 has fixed the following..

0.1.2 broke auto updates.
Basically there was an error message in the dashboard that a user was complaining about, upon fixing this I realised that auto-updating stopped working… I’m using cron updating so I didn’t spot this right away. I have now re-tested auto updates, and it is working for me in 0.1.3

Execution timeout issues
linickx.com was having execution timeout issues, i.e. the script was being terminated by a low value in php.ini. set_time_limit(20) now happens before each fetch_feed to give each http request an extra 20seconds of execution time, I’ve also setup an is_running variable so multiple fetchs don’t happen at the same time, this should fix the multi-post issue I’m having here too!

config.php
I’ve also introduced a config.php so that upgrades do not overwrite $WPDIR set by users. It’s become apparent that users want to use cron to update their feeds, since run.php gets overwtitten on every upgrade then users would need to re-edit the file, this would become quiet annoying. Copy config.sample.php to config.php and users shouldn’t have to worry about upgrades breaking this as the package will be re-pushing the sample leaving your file un-changed… this is exactly how WordPress handle this issue in the core.

Fingers Crossed!
I’m hoping that’s the end of the bug fix releases and I can get on with Version 0.2 will be a feature release :)

Version 0.1.1

So the first few issues are flowing in… the package on wordpress.org didn’t work… I developed the plugin in a folder called lnx_lifestream but wordpress.org’s fancy system changed the path to linickx-lifestream – DOH!

There was also an FAQ missing from the readme.txt, ie how to resolve the error message…

Can’t find WordPress, edit $WPDIR in run.php

This has now been fixed (link to faq)) but does shed light on a new issue… any changes to run.php get over-written on upgrades, I will need to think of a new plan to overcome this!

Introducing LINICKX LifeStream V0.1

UPDATE: This Plugin has been updated, the below links to the new file, but please comment on the new post, thanks.

I’m proud to share with the WordPress community my new plugin, LINICKX LifeStream :)

I’ve been trying to get more LifeStreaming into LINICKX.com for a while, as I’ve struggled to find an appropriate solution I’ve decided to write my own.

Plug-in Features:

  • Stream Any Feed.
    Most internet services like digg, twitter, lastfm and the like support RSS feeds of your activity, so you can stream any service even if I haven’t heard about it yet!
  • Posts are created from the feeds/stream.
    Each Feed item creates a new post, you can tag & categorise your posts to give each stream a different look & feel in your WordPress templates.
  • No dependencies.
    LINICKX LifeStream uses WordPress functions to do it’s work, so yes it’ll work on PHP4 & PHP5 and you don’t need to update simplepie or an-other dependancy.
  • Flexible updating.
    By default LINICKX LifeStream should just work, WordPress will fetch the feeds every 5 minutes and store them in the WP Database, but you can change that. If you want to cron your updates every 1 minute you can, if you want the DB store in a file not in MySQL that’s not a problem either.

LINICKX Lifestream is currently feeding both my Digg & Google Reader posts; in general I’m pretty poor at updating my plug-ins as this is a hobby, but since this project is part of my website and not a favour for a friend (like the others) I’m hoping to do a better job.

I’m looking for help too!
The admin interface is a bit “clunky”, the reason being I don’t know javascript, if you do please consider writing a patch :)
I also think this plugin would work well for WordPresMU users, but I don’t use it so if you do what changes need to be made to make this work for you?

You can download the source from here: http://plugins.svn.wordpress.org/linickx-lifestream/ or Browse Trac

Disclaimer
As with my other plug-ins this is a hobby, I have a full time job that takes priority. Feel free to leave comments here but ask support questions to the WordPress community. I will update this plugin as and when I need features to improve linickx.com but will consider any patches submitted and any good ideas you have.

If this plugin has been some use to you, please consider donating as I give this code away for free and giving something back will make you feel good :cool:

UPDATE(s):

  • Pushed version 0.1.1 as the directory path changed when wordpress.org created their .zip file… all should be working again.
  • Pushed version 0.1.2 to fix error in dashboard reported by Markus below.
  • Pushed Version 0.1.3 more bug fixes; 0.1.2 broke auto updates, so 0.1.3 fixes it again!
    linickx.com was having execution timeout issues, so theres a patch to fix that for other users
    I’ve also introduced a config.php so that upgrades do not overwrite $WPDIR set by users.

Get ready for LINICKX LifeStream!

Colleagues have noticed that in my spare time at work I’ve been “getting my geek on!” the definition being a vi window of code on one screen and google open in the other ;)

Linickx LifeStream will be a new WordPress plugin which allows you to life stream ANY feed. I’ve been having issues with FeedWordPress and to be honest it didn’t really do what I wanted; now there are already may wordpress lifestream plug-ins, but mine will be different.

Difference 1: The plug-in isn’t service dependant… i.e. you don’t stream your twitter account or your LastFM account, you stream the feed. What this means is that when tomorrows-wizzy-new-service is launched you don’t have to wait for me to update the plug-in. It also means you can stream odd stuff, such as I’m going to stream my commits to the WordPress plug-in repo ;)

Difference 2: No Requirements. The requirements for this are the same as the WordPress requirements. What this means is yes it works on PHP4 and no you don’t need a separate installation of simplepie.

Difference 3: No Lifestream Pages, extra databases or tables. LifeStream feeds get created as “normal” WordPress posts, so if you digg something a post is created and you can do all the normal things like tag & categorize the post.

I’m in the process of finishing the package and installing the plug-in here on linickx.com but when it’s ready you’ll be able to…

Download LINICKX LifeStream Here

With a little luck I’ll be able to remove this annoyance and directly stream delicious and get google reader working again.

Submit Bugs to TRAC

Support for linickx plugins has always been community driven, but recently I’ve had a few bugs and patches submitted via email.

To make like simpler I’ve found that I can track bugs using trac – bad pun!

Here are some links :)

The difference between the two is simple: if you want help then click the support link if you want TO help then file a bug or submit a patch :)

phpbb_recent_topics_0.5.3

0.5.3 is a minor update which fixes this issue whereby some users got this error in their admin screens


Warning: Invalid argument supplied for foreach() in /public_html/wp-content/plugins/phpbb-recent-topics/display/admin-options.php on line 144

If you don’t have this issue upgrading is optional, download from the usual place!

phpbb_recent_topics version 0.5

UPDATE: This Plugin has been updated, please download the update from http://wordpress.org/extend/plugins/phpbb-recent-topics/, and please comment on the new post, thanks.

Screenshot phpbb_recent_topics admin page

Screenshot phpbb_recent_topics admin page

Admin GUI

Version 0.5 is the first enhancement update to php_recent_topics for a looooooonnnng while!

Actually it’s taken me soo long to finish that we’ve jumping straight into 0.5.2 0.5.3 which includes bug fixes from 0.4.1 & 0.4.2

There are four notable changes, two minor, two major :D

Minor CHANGE 1: You should notice the admin page don’t look so rubbish, we’re now using the new CSS provided by the WordPress team!

Minor CHANGE 2: The SQL syntax now excludes SPAM from being shown up in the wigdet by only selecting “Approved” posts, thanks Ashish.

Major CHANGE 1: The admin page now has the option for excluding forums from being displayed by the widget, this was one of the most requested features but please be advised this change means there are New database permissions required for upgraders!
Before you did GRANT SELECT ON phpbb_database.phpbb_topics TO wp_user@localhost; NOW DO THIS TOO….

GRANT SELECT ON phpbb_database.phpbb_forums TO wp_user@localhost;

Major CHANGE 2: The plugin now supports “Insecure” Database connectivity, getting the plugin to talk to the PHPBB DB seemed to be the biggest hurdle for most, so I’ve added a simpler way to keep my SPAM down. This approach is not recommended as the plug-in stores your PHPBB DB credentials IN CLEAR TEXT in the WordPress database. As a side effect from this is, now users can connect to a PHPBB database installed on a different server to WordPress – This suggestion actually came from someone called Nedim.. Thanks!

Some of the usual information now follows….

Download phpBB_Recent_Topics_0.5.2 from wordpress.org

The Installation

Before starting you need to get your database configuration sorted. So, are you going to connect to the PHPBB Database securely or Insecurely?

To connect Securely you need to GRANT access TO WordPress FROM phpbb.

How to GRANT wordpress read only access to phpBB ?
If you don’t know it already you need to find your wordpress mysql user id, it’ll be in wp-config.php

define('DB_USER', 'wp_user');     // Your MySQL username

and you should have already found your phpbb database & table for the above.
You need to type the following syntax into your mysql database

GRANT SELECT ON phpbb_database.phpbb_topics TO wp_user@localhost;

AND

GRANT SELECT ON phpbb_database.phpbb_forums TO wp_user@localhost;

this can be achieved by logging into phpmyadmin as your phpbb user, selecting SQL and pasting the correct GRANT into the text box.

WordPress Installation

  • Unzip phpbb_recent_topics.tgz in your `/wp-content/plugins/` directory. (You’ll have a new directory, with this plugin in /wp-content/plugins/phpbb_recent_topics)
  • Activate the plugin through the ‘Plugins’ menu in WordPress
  • Configure the plugin, you need to tell wordpress about phpbb, this is done in the wordpress menu ‘Settings’ -> ‘phpBB Recent Topics’
    The following Settings are required:

    • * The name of your phpBB database (e.g phpbb)
    • * The name of the table where topics are held (the default is phpbb_topics )
    • * The full url of your forum for links (e.g. http://www.mydomain.com/forum)
    • * The number of topics to show. (If left blank you get 5)
    • * The Date Formatting, i.e. “d/M/y – g:i a” similar to the WordPress “General Settings”
  • The use of Insecure connectivity is optional – See Below
  • Tick the boxes of any Forums you don’t want this plugin to show posts from
  • Hit ‘Update Options”
  • To output the list of topics in a page or post…
    • * create a new page/post, type {phpbb_recent_topics} , hit ‘Publish’ or ‘Create new page’

    To output the list of topics in your theme sidebar using the widget…

    • * click “design” in the dashboard
    • * click “widgets”
    • * next to phpBB Recent Topics click “add”
    • * click “save changes”

    To output the list of topics in your theme sidebar using a template tag…

    • * edit sidebar.php and inside <div id=”sidebar”> type…
      <?php
      if (function_exists('phpbb_topics')) {
      phpbb_topics();
      }
      ?>

What is Insecure MySQL Connectivity & How do I use it?
If you need to you can connect in a less secure manner, the connection details held in your PHPBB config.php can be loaded into WordPress. This is insecure becuase the phpbb3 credentials are store in clear text, this is bad cuase if someone somehow comprised WordPress they’d have full access to PHPBB.

To use, tick the “Enable Insecure Database Connection” box, and submit, when the page re-freshes you’ll have some more boxes to populate, from your phpbb config.php fill in


$dbuser = phpbb MySQL Database UserName
$dbpasswd = phpbb MySQL Database Password
$dbhost = phpbb MySQL Server

Click update, and you should be connected!

Support
I’ve always been honest about support, there isn’t any. Basically I write this for my own needs and then publish it for you to use for free. You’re more than welcome to post comments here and if you tag wordpress forum posts with “phpbb-recent-topics” I’ll reply to you there, but we all have busy lives and I make no promises on how quickly I’ll reply to you.

Link for posting in the correct phpbb-recent-topics forum

Finally Subversion
The source for this plugin is in the wordpress subversion, you can download it directly from here; and when wordpress.org re-crawls my readme the latest version will also be available on wordpress.org/extend/plugins/

I hope you enjoy my plug-in!

Follow plug-in development progress

The WordPress plugin trac is a really cool resource, one of my favourite features is the commit log.

Development progress of linickx plugins is always going to be slow because I have a day job but when I find the time to develop updates I try to commit them to the community as often as I can so users can stay in the loop…. The thing is users don’t necessarily know the log is there, so here’s a couple of links for you…

If you want test drive my development versions on your blog you can download them from wordpress.org here and here respectively, feel free to submit patches to fix bugs or implement features, I’m always open to suggestions and work is always accredited appropriately.

Introducing root cookie 1.5 now with subdomain support!

UPDATE: This Plugin has been updated, please see the new post, comments here are now closed.

A long time ago Sc0ttClark came to me and suggested that his cookie subdomains plug-in & my cookie path plug-in should be merged…. well I’ve finally done it!

There was a little delay in the release as the initial code only worked for top level .com, .net & .org style domains but a simple “manual” option in the admin screen now allows you to set the domain name, so longer domains like .co.uk can be supported!

All previous functionality is supported, just by enabling the plug-in the path is stripped out you only need to go into the admin page if you want to change the subdomain of the cookie.

The admin page now has a “News & Tutorials” feed (subscribe) my plan is to post articles on how to use root-cookie.

You can download the plugin from wordpress.org, and there is a discussion forum to get community support.

Twitter Tools is for Twitter Tools

Those with a keen eye may have noticed that my tweets / status updates didn’t start with “is” until recently that’s because posts that appeared here on my blog would look stupid and out of context, who starts a post “is” ???

To solve the problem attached is a small plugin for Alex Kings Twitter Tools, it’s a simple WordPress filter which prepends posts which begin with “is” with the author name, example:

is testing his new WP plugin.

becomes

Nick is testing his new WP plugin.

If I get some positive feedback I might publish this in WP’s plugin directory.

Installation is easy, rename twitter-tools-is.txt to twitter-tools-is.php and save it in your wp-content/plugins directory, enable the plug-in the “normal” way and job done, no further configuration required!

phpbb_recent_topics fixed for 2.8.3

UPDATE: This Plugin has been updated, please download the update from http://wordpress.org/extend/plugins/phpbb-recent-topics/, and please comment on the new post, thanks.

This update fixes 0.4.x branch of my plugin, specifically the “You are not allowed to access this page” error that WordPress 2.8.1 introduced. No other changes have been implemented, the SVN Trunk (0.5.x) is still to be updated.

UPDATE: 0.5.x works in WP.2.8.3, also 4got to tag this post – DOH!

The usual paste follows….

phpBB Recent Topics Admin interface in WordPress
Admin GUI

Download phpBB_Recent_Topics_0.4.2 from wordpress.org

What’s New?

  • Plugin fixed for WP 2.8.3.

What’s Old?

  • The widget patch submitted by toni.
  • I have tested this plugin with phpBB3 .
  • I finally quashed the install bug where by phpbb-recent-topics was confused with phpbb_recent_topics.
  • Sidebar Widget, yus for all you non-php people you have a widget to play with.
  • Edit the Time & Date layout – leave blank to remove it completely

The Installation

  • Unzip phpbb_recent_topics.tgz in your `/wp-content/plugins/` directory. (You’ll have a new directory, with this plugin in /wp-content/plugins/phpbb_recent_topics)
  • Activate the plugin through the ‘Plugins’ menu in WordPress
  • Configure the plugin, you need to tell wordpress about phpbb, this is done in the wordpress menu ‘Settings’ -> ‘phpBB Recent Topics’
    The following Settings are required: 

    • * The name of your phpBB database (e.g phpbb)
    • * The name of the table where topics are held (the default is phpbb_topics )
    • * The full url of your forum for links (e.g. http://www.mydomain.com/forum)
    • * The number of topics to show. (If left blank you get 5)
    • * The Date Formatting, i.e. “d/M/y – g:i a” similar to the WordPress “General Settings”
  • Hit ‘Update Options”
  • To output the list of topics in a page or post…
    • * create a new page/post, type {phpbb_recent_topics} , hit ‘Publish’ or ‘Create new page’

    To output the list of topics in your theme sidebar using the widget…

    • * click “design” in the dashboard
    • * click “widgets”
    • * next to phpBB Recent Topics click “add”
    • * click “save changes”

    To output the list of topics in your theme sidebar using a template tag…

    • * edit sidebar.php and inside <div id=”sidebar”> type…
      <?php
      if (function_exists('phpbb_topics')) {
      phpbb_topics();
      }
      ?>

A bit about Database configuration.
If wordpress & phpBB share a DB already then set $PHPBBDB to DB_NAME and everything will be fine, else you’re going to need to GRANT the wordpress user read access to phpBB.

How to GRANT wordpress read only access to phpBB ?
If you don’t know it already you need to find your wordpress mysql user id, it’ll be in wp-config.php

define('DB_USER', 'wp_user');     // Your MySQL username

and you should have already found your phpbb database & table for the above.
You need to type the following syntax into your mysql database

GRANT SELECT ON phpbb_database.phpbb_topics TO wp_user@localhost;

this can be achieved by logging into phpmyadmin as your phpbb user, selecting SQL and pasting the correct GRANT into the text box.

Frequently Asked Questions

  • Is phpbb3 supported?
    • yes.
  • Can I output 10 Topics in my Page, and 3 Topics in my Sidebar ?
    • Yes ! In the WordPress menu ‘Options’ -> ‘phpBB Recent Topics’, set ‘The number of topics to show’ to 10, and then in your sidebar include…<?php
      if (function_exists(‘phpbb_topics’)) {
      phpbb_topics(3);
      }
      ?>
  • Can I exclude a certain forum from the list ?
    • In this version, the only way to do that is to hack /wp-content/plugins/phpbb_recent_topics/display/display.php, change
      $results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE ORDER BY topic_time DESC LIMIT $LIMIT");

      to

      $results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE forum_id != 1 ORDER BY topic_time DESC LIMIT $LIMIT");

      to exclude forum 1 from the list. I plan to setup a proper solution to this in the next version.

  • Why is the date config under settings not in the widget configuration?
    • The date settings effect both the template tag and the widget :)

Support
I’ve always been honest about support, there isn’t any. Basically I write this for my own needs and then publish it for you to use for free. You’re more than welcome to post comments here and if you tag wordpress forum posts with “phpbb-recent-topics” I’ll reply to you there, but we all have busy lives and I make no promises on how quickly I’ll reply to you.

Link for posting in the correct phpbb-recent-topics forum

Finally Subversion
You also might be interested to know that I’ve been getting to grips with the wordpress plug-ins svn, so you can get work directly from here; and when wordpress.org re-crawls my readme the latest version will also be available on wordpress.org/extend/plugins/ :cool:

Latest WordPress Milw0rm exploits PIPE’d to your feed reader!

Milw0rm is a great source of security exploits, subscribing to it’s feed is a good way of getting a heads up on where the next attack might come…. there are a lot of script kiddies that do nothing more than download milw0rm exploits and fire them randomly into the internet hoping to get a hit!

The thing is there are a lot of exploits found everyday and it can start to fill-up your RSS Feed Reader, so it’s a good idea to filter out things that are useful to you, as an expample I have created a simple Yahoo! Pipe which delivers only WordPress exploits found on Milw0rm!

PIPE URL: http://pipes.yahoo.com/linickx/milw0rmwordpress
FEED: URL: http://pipes.yahoo.com/pipes/pipe.run?_id=RDnArZNk3hGthFdiUpWufg&_render=rss

The pipe / feed is currently empty – returns no results – as there hasn’t been anything new published recently, but I’m sure that’ll change soon enough :)

root-cookie – Tutorial 1: Accessing WordPress cookies from custom scripts.

I’ve been wanting to do this for a while, this is the 1st in a planned short series of tutorials for my root cookie WordPress plugin.

I’ve decided to start with the purpose I wrote the plugin, then I’ll move onto a couple of tutorial which answer some of the FAQs I get.

Scenario.
Before you start you need a working copy BLANK of WordPress, in a sub directory, with a url like domain.com/wordpress.
A BLANK copy is a fresh install, using the default theme and only my root-cookie plugin installed, remember after activating the plugin clear your browsers cookies.

Getting Started.
So you have a ready & waiting copy of WP, next create a directory called “my-scripts” or whatever you like, and in it create 1.php with the following contents:


<?php
print_r($_COOKIE);
?>

Browse to domain.com/my-scripts/1.php and you’ll get a blank white page with Array().
Next log into WordPress, and re-fresh 1.php and you should get something like….

Array ( [wordpress_xxxxxxxxxxxxxyyyyyyyyyyyyyy] => admin|1241455565|xxxxxxxxxxxxxyyyyyyyyyyyyyy [wordpress_logged_in_xxxxxxxxxxxxxyyyyyyyyyyyyyy] => admin|1241455565|xxxxxxxxxxxxxyyyyyyyyyyyyyy )

Done! You’ve just accessed WordPress’s cookies :)

Now when I first started I had a very basic script which hid my Google adverts when I’m logged in, it’s against Google’s policies to click on your own adverts so to avoid accidents I wanted to hide them.

The following script is NOT secure, it doesn’t check that you’ve logged into WordPress it simply checks that you a cookie set with the right username (which anyone can fake) but for my purpose this was fine, I had no issues with users faking cookies to get rid of the adverts*


<?php
if (isset($_COOKIE["wordpress_logged_in_fxxxxxxxxxxxxxyyyyyyyyyyyyyy"])) {
$cookie = $_COOKIE["wordpress_logged_in_xxxxxxxxxxxxxyyyyyyyyyyyyyy"];
$cookie_elements = explode('|', $cookie);
if ($cookie_elements[0] == "admin") {
echo "<h1>Hello admin!< </h1>";
}
}
?>

Replace admin with whatever username your using and job done! Next time Accessing two WordPress installs domain.com/blog1 domain.com/blog2 with root-cookie :)

*this will not work now, as I do something different. :)