Heroes

Lose today by less than 13 points, and the Irish team will be welcomed home as heroes.

Win today, and they will be legends.

Irish Team vs Wales, 1948

  • HIGGINS
  • O’HANLON
  • MCKEE
  • REID
  • MULLAN
  • KYLE
  • STRATHDEE
  • DALY
  • MULLEN
  • MCCONNELL
  • CALLAN
  • NELSON
  • MCKAY
  • O’BRIEN
  • MCCARTHY

Irish Team vs Wales, 2009

  • KEARNEY
  • BOWE
  • O’DRISCOLL
  • D’ARCY
  • FITZGERALD
  • O’GARA
  • O’LEARY
  • HORAN
  • FLANNERY
  • HAYES
  • O’CALLAGHAN
  • O’CONNELL
  • FERRIS
  • WALLACE
  • HEASLIP

New WordPress Plugin – Email Post Activation

I was looking into blogging via email1, and I couldn’t get it to work. Until I discovered that WordPress has to be told to check for any new emails.2.

In order to process the email post, WordPress uses wp-mail.php. Loading this page in your browser will tell WordPress to check for new email posts. There are three ways to call the file:

  • By visiting the URI to wp-mail.php in your browser,
  • By using Cron to automatically load the file after a set period of time, or
  • By including a hidden iframe in your Blog footer that links to wp-mail.php.

Not all WordPress users have the ability to edit their crontab and even more have no interest in editing their theme files. So I wrote a simple plugin that will add the iframe to the the blog footer.

When I say simple, I actually mean simple – there’s all of 3 lines of code in this plugin, so not much can go wrong with it.3

You can read more about it here.

  1. The reason for which I’ll go into in a later post []
  2. I should of realised this, but it was so obvious that I didn’t even consider it []
  3. Having just re-read that, it looks like I’m tempting fate. []

Using WordPress Templates to Create Forms

For the past week I’ve been working on integrating a custom form into a WordPress installation. Yes, I know there are a whole host of plug-ins out there that will allow you to add a form to your WordPress blog, but I had some pretty unique criteria that needed to be met. The criteria couldn’t be satisfied by a plug-in, so I had to roll my own.

The criteria were that the details returned by the form had to be stored in a separate database, had to have a form for user submitted data, a form for administration and had to allow me to add new queries as required. And all had to be accessible from within WordPress. So here are the basics of how I went about it.

The first step is to create a page template containing your form, e.g. my-form.php. Creating a page template is as easy as including the following lines at the top of your template:

<?php// Template Name: My Page Template?><?php require("my-form-functions.php"); ?><?php get_header(); ?><?php get_sidebar(); ?>

The last line of your template should be:

<?php get_footer(); ?>

Save the file in your theme directory. Use the following syntax when creating the HTML for your form:

<form name="my-form-name" action="" method="post">

There are two important points to note about the above code examples:

  1. The PHP require statement pointing to the name of the function file that will process your form, and
  2. the form action attribute is empty.

The first is important as I found that using your theme’s function.php can sometimes lead to problems. For example, I was unable to login to WordPress with my form processing contained in functions.php.

By leaving the action attribute empty, the form will be submitted to the containing page. Trying to direct the form to another custom page just results in a “Sorry, not found” error message from WordPress.

Because you are using the same page to display and process the form, you’ll need to create a PHP function that checks if the form is being submitted or if it is the users first visit to the page.

The easiest way to accomplish this is to include a hidden input in your form and to check the PHP $_POST global variable for the presence of the hidden input. For example, you could use code something like this:

function CheckSubmit() {if (array_key_exists('process-form', $_POST)) {.....do something.....}}

This code assumes that you have a hidden input named process-form. The value of the hidden input doesn’t matter as $_POST will only contain data if a form has been submitted. In other words, if the user has just accessed the page, $_POST will be empty and no code will be executed.

The last step is to create a new WordPress page and to use your new custom form page as the Page Template.

Due to the large number of people requesting a copy of the code I used, I’ve uploaded it my Page Template and you can download it here.

About my Code

File descriptions: comment-card.php is the page template that displays the form and com-functions.php contains the code that makes the form work.

Database details: This code was written to connect to a database containing 2 tables – responses and details. The com-functions.php file uses four constants to define your database connection details. These must be updated if you want your form to work.

Form questions: The questions in this page template are specific to the site I developed it for, so each question is validated accordingly. If you change the questions, you will also need to change the ValidateForm() function in com-functions.php.

Comment Admin: The download also contains an admin interface contained within the com-admin folder. This folder should be kept outside the WordPress hierarchy, in other words, save it to a completely separate folder from your blog.

The admin interface provides basic search and a form to send SMS text messages. The SMS facility is provided by a company called Esendex and the SMS form uses their PHP API. More information from the Esendex website.

If you have any questions, please feel free to post a comment.

New WordPress Plugin – Paul’s Latest Posts

I’ve written a new plugin for WordPress called Paul’s Latest Posts. This sidebar widget pulls your latest posts and displays them with an excerpt. I’ve just gotten confirmation from WordPress Plugins that it’s been approved for hosting on the official WordPress Plugins page. It’s not showing yet, but when it is I’ll provide the link and you can tell me what you think.

Top 20 Irish Blogs By Traffic

Being that it’s the first day of 2009, it’s common to do some sort of review: what was good, bad, popular and unpopular about the year that’s just past.

I couldn’t be bothered.1

Instead, I decided to do a “snapshot” post – one of those posts that looks at something current, so that in twelve months time I can look back, do it all again and say “Look what’s changed in the last twelve months”.

After my previous post about the most popular social networking sites in Ireland, I decided to have a look at the most popular Irish Blogs. Before I go through the list, here’s a couple of things to remember:

  • I checked the rankings for 179 blogs. This is by no means an exhaustive list of Irish blogs, so if your one isn’t on the list, email me and I’ll update it.
  • The list of blogs was taken from my own feed reader and from the Blogrolls of a couple of the more popular blogs on this list.
  • The traffic data is taken from Alexa, so while it may not be entirely accurate, it should give a general indication of the relative popularity of those on the list.
  • The traffic is based on the last three months only.
  • The traffic stats do not contain any information regarding email or RSS subscribers.
  • Due to the way that Alexa gathers traffic stats, I was unable to gather stats for blogs hosted on the following sites: blogs.ie, cluas.ie, blogs.msdn.com, blogs.linux.ie.

So with all of that out of the way, lets move on to the list:

Number 20 – John Breslin

John Breslin

John Breslin

Number 19 – Bernard Goldbach

Bernard Goldbach

Bernard Goldbach

Number 18 – Cybercom

Cybercom

Cybercom

Number 17 – John M. Ryan

John M. Ryan

John M. Ryan

Number 16 – Twenty Major

Twenty Major

Twenty Major

Number 15 – Grannymar

Grannymar

Grannymar

Number 14 – K8 The G8

K8 The G8

K8 The G8

Number 13 – Limerick Blogger

Limerick Blogger

Limerick Blogger

Number 12 – Jason Roe

Jason Roe

Jason Roe

Number 11 – Whois Ireland

Whois Ireland

Whois Ireland

Number 10 – Cormac Moylan

Cormac Moylan

Cormac Moylan

Number 9 – Frank Prendergast

Frank Prendergast

Frank Prendergast

Number 8 – Sabrina Dent

Sabrina Dent

Sabrina Dent

Number 7 – Bock The Robber

Bock The Robber

Bock The Robber

Number 6 – Head Rambles

Head Rambles

Head Rambles

Number 5 – Tom Raftery

Tom Raftery's I.T. Views

Tom Raftery's I.T. Views

Number 4 – Michele Neylon

Michele Neylon

Michele Neylon

Number 3 – Donncha O’Caoimh

Donncha O'Caoimh

Donncha O'Caoimh

Number 2 – Redfly Marketing

Red Fly Marketing

Red Fly Marketing

In at number one, drum roll please….

Number 1 – Damian Mulley

Damian Mulley

Damian Mulley

In the interests of transparency, you can download the full list of blogs that I checked here. The file is a standard .csv.

  1. Mainly because my memory is so bad, I can’t remember what was good or bad about last week, never-mind the last twelve months. []