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 :)

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.

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!

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!

WordPress Plug-in Order

Whilst playing with my bad-behavior callback function, I noticed something quite crucial; plug-ins load in alphabetical order!.

I noticed that every time a new version of BB is released / upgraded I had to re-paste my callback function into bad-behavior-wordpress.php – DOH!

To get around this I decided to create a new plug-in called linickx-bb-callback.php, but I noted that the counter wasn’t increasing. Changing the file name to aaa_linickx-bb-callback.php fixed the issue, sweeeeet!

Bad Behaviour and Akismet Blocked Counters for WordPress

The Bad Behaviour plug-in for WordPress comes with a weekly counter in the admin dashboard, but do you want a wicked footer like mine?

106,386 dodgy geezas have been blocked by Bad Behaviour and 36,926 spams were eaten by Akismet.

Akismet comes with a counter you can use in themes/plugins…


$akcount = get_option('akismet_spam_count');
$akcount = number_format($akcount);
echo $akcount;

But with Bad Behaviour you have to do a little more work. To start with you need to get BB to record in the database each time it blocks someone, this is done by adding a function to ~/wp-content/plugins/bad-behavior/bad-behavior-wordpress.php , add the following code…..

// Bad Behavior callback functions.
function  bb2_banned_callback() {

        $counter = get_option('bad_behavior_spam_count');
        $counter = $counter + 1;
        update_option( 'bad_behavior_spam_count', $counter );

}

Now BB will store an incrementing number in the WP database for you to use in your theme..


$bbcount = get_option('bad_behavior_spam_count');
$bbcount = number_format($bbcount);
echo $bbcount;

Now you can track how many inter-twats your blocking!

phpbb_recent_topics version 0.4.1

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 is a small update, it incorporates the patch submitted by toni to fix the widget, thanks toni :)

The old information still applies…

phpBB Recent Topics Admin interface in WordPress
Admin GUI

If you’re happy with v0.4 and have it running fine then don’t bother, in fact edit phpbb_recent_topics.php so that WordPress stops complaining about finding a newer version.

Download phpBB_Recent_Topics_0.4.1 from wordpress.org

What’s New?

  • The widget patch mentioned above!

What’s Old?

  • Most importantly I have tested this plugin with phpBB3 and WP2.5 so I’ve updated the readme.txt to reflect this.
  • 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:

Root Cookie for WP 2.6

UPDATE: This Plugin has been updated, please comment on the new post, thanks.

Thanks to Scott Kingsley Clark for giving me the kick I needed, but I’ve finally gotten around to updating my root Cookie plugin for WordPress, we’re now at Version 1.3 !!

The point of the plugin is to strip out the path from the cookie so that it can be referenced by other applications; wordpress 2.6 has a whole new cookie structure and this broke the old version, but I’ve been so swamped recently that it wasn’t maintained.

Scott is one of the very few nice people in the world who instead of grumbling offered up a patched plugin, actually I’ve done it a different way but I appreciate his support anyway.

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

Enjoy!

Missing argument 1 for phpbb_topics()

I thought I’d write a post about this error message as it’s pretty much the main reason that I ever receive comments or e-mails from the WordPress community. Sadly the complaints I receive from the community out weigh the complements, but I guess that’s life ;)

Thank you to all those who have downloaded and enjoyed my plug-in and all those who have taken to say something nice.

The problem with this error message Missing argument 1 for phpbb_topics() is that I don’t actually know how to fix it. If you look in the source code you’ll see that I’ve tried to trap “empty variables”…

if (is_null($LIMIT)) {
                $LIMIT = 5;
}

Now this approach seems to work on my server(s), and works for some people, but there are a number of people whom is doesn’t work for; unfortunately the majority of the WP community are no more technical than myself and I have never received any feedback on how to fix this.

I’m not a programmer, I’ve never claimed to be a PHP guru; as I don’t know how to fix this problem in the latest version of phpbb-recent-topics I tried to combat the problem by introducing a widget. The widget it aimed at people who don’t know php, it allows you to “drag” the list of recent topics into your sidebar, but for some reason people still prefer to edit their sidebar.php :confused:

I would to remind all readers that it quite clearly states on my announcement :

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.

Currently the only solution I can offer to anyone suffering from this error message is to replace phpbb_topics() with phpbb_topics(”5″), if that doesn’t work then please accept my apologies.

If anyone would like to offer a patch for my plugin I would gladly include it and accredit appropriately.

Thanks for Reading!

Recent phpBB Topics on WordPress Plugin v0.4

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.

phpBB Recent Topics Admin interface in WordPress
Admin GUI

It’s been a year since the last release so perhaps this version should be called “about time!” v0.4 has primarily been released as a bugfix version, if you’re happy with v0.3 and have it running fine then don’t bother, in fact edit phpbb_recent_topics.php so that WordPress stops complaining about finding a newer version.

Download phpBB_Recent_Topics_0.4 from wordpress.org

What’s New?

  • Most importantly I have tested this plugin with phpBB3 and WP2.5 so I’ve updated the readme.txt to reflect this.
  • 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

What’s Old? – aka: 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.

EDIT: Found a 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: