Archive for Development

Photo Blogging

Readers probably wouldn’t have taken much notice of the recent photo posts here and here on my site. The thing is though, these are a result of a bit of ingenious behind the scenes code that allows me to snap a picture with my BlackBerry camera and blog it in seconds thus allowing me to start a photo blog category that comprises of quick snippets with a photo for when a picture is more appropriate and I’m no where near a computer.

The real power behind this is Flickr but as those who know me will testify, I don’t like to use external services that take people away from my site, so I devised a way to bring the convenience of mobile Flickr uploads to my blog rather than to Flickr.

To begin with, the easy bit. I registered a Flickr account and installed the Flickr application on my BlackBerry. Now I can take a photo with the BlackBerry and send it to my Flickr photo stream with a title and a caption in a few seconds. Now comes the hard bit. Getting the stream on my blog and removing any Flickr artifacts along the way.

The saving grace here is that Flickr provides an RSS2 feed of any users photostream (so long as it’s set to public). In addition to this, there is a popular WordPress plugin called Feed WordPress that allows the syndication of RSS feeds onto your blog. I installed this plugin and subscribed to my Flickr feed with it. Now I was getting all photos posted to Flickr on my blog, I just had some cleaning up to do, and annoyingly, this is what took the time and effort.

Firstly Feed WordPress is designed to list all feeds coming into a blog as contributors so you can give appropriate credit. In my case though it was my own Flickr feed so I wanted to avoid this link category being shown on my site. To fix this I specifically excluded the category Feed WordPress had earmarked for contributors by specifying it in the arguments of the theme function that displays the links list. Users who are using a theme with widgets or who haven’t customised their site as much as I have might be able to use widgets to do this.

Secondly I had to change some Feed WordPress settings to get perfect operation. Mainly forcing all “posts” from Flickr to go into my Photo Blog category and also to ensure that all these would be attributed to my username. I also entered the default Flickr e-mail address, nobody@flickr.com, as an allowed user such that my Flickr entries would be syndicated without going through moderation. This would be a security risk if I wasn’t the only person who could add feeds to my syndication list or post to feeds already earmarked for syndication but as neither of these situations are true its ok.

Finally I needed to ensure that the actual body of the post appearing on my site showed the proper content. By proper content I mean a good sized image, linked to the original and showing nothing else alongside it but the caption and no reference to Flickr.

To do this I used a custom code modification to Feed WordPress which would extract the true location of the picture in the Flickr feed and store it as an attribute of the post. For those wishing to replicate what I have done here, the code below needs to be entered inside the SyndicatedPost class, at around line 1100 in the feedwordpress.php file of the Feed WordPress plugin.

if (isset($this->item['http://search.yahoo.com/mrss/']['content@url'])) :
$this->post['meta']['flickr_original_image'] = $this->item['http://search.yahoo.com/mrss/']['content@url'];
endif;

In addition to the Feed WordPress modification I also added a plugin hook that would parse the content of all posts in the Photo Blog category in order to retrieve the image location stored with the above code, correctly display it and to parse the remaining text for the caption thus remove references to Flickr. In the code below the number 36 refers to the id of my Photo Blog category.

/*
Plugin Name: Fix Flickr Posts
Plugin URI: https://www.kieranoshea.com/
Description: This plugin removes cruft from the posts imported from flickr
Author: Kieran O'Shea
Author URI: https://www.kieranoshea.com
Version: 1.0
*/

// Apply function to remove content from posts in the correct category
function fixFlickr($content) {
global $post;

$first_cat_id = get_the_category($post->ID);
$first_cat_id = $first_cat_id[0];
$first_cat_id = $first_cat_id->cat_ID;

$flickr_image = get_post_custom($post->ID);
$flickr_image = $flickr_image['flickr_original_image'][0];

if ($first_cat_id == 36)
{
$photo_bit = '<a href="'.$flickr_image.'"><img src="'.$flickr_image.'" width="450" alt="'.$post->post_title.'" border="0" /></a>';
$pwned = explode('<p>',$content);
$pwned = $pwned[3];
$text_bit = '<p>'.$pwned;
$content = $text_bit.'<div style="text-align:center;border:0;">'.$photo_bit.'</div>';
}
return $content;
}

// Add filter to the_content
add_filter('the_content', 'fixFlickr');
add_filter('the_excerpt', 'fixFlickr');
add_filter('the_content_rss', 'fixFlickr');
add_filter('the_excerpt_rss', 'fixFlickr');

And there we have it, my own photo blog that leverages power from the Flickr system but which displays in my own way on my own site. If you want to try this by all means test out the above method and code but I must stress that this method is unsupported by me or anyone else. If you try it and get it to work, please comment below. It is worth noting that any phone with a camera and a Flickr upload program designed for it will work in place of a BlackBerry. To all that succeed with this method, happy photo blogging!

Comments (2)    

Calendar 1.2.1

I’ve pushed out a quick update to Calendar for WordPress. I’d had a few bugs reported with styles that I wanted to fix for perfections sake, but also some more serious issues concerning compatibility with the legacy 2.0.x branch of WordPress. Keen to keep my word on backwards compatibility I fixed the issues, ran some tests and pushed out a new minor version release this morning.

No security issues are fixed in this upgrade so there is no rush to update if you don’t want to but if you are running the WordPress 2.0.x branch I recommend updating as soon as possible so you will be running bug free.

You can grab your copy straight from WordPress.

For those who want to pick up the slightly fixed styles you will need to use the “Reset Styles” tick box on the calendar options screen after upgrading – be aware that you will lose any modifications you have made to calendar styles if you do this.

Comments (26)    

Calendar 1.2 hits WordPress.org

After the latest testing of the release candidate I was pleased to find few if any bug reports and so I have decided to push the release live. I updated the WordPress Plugins SVN repository yesterday and the 1.2 final version is now available for download on WordPress.org and on my site.

I was pleased to note that the download record was broken yesterday on the WordPress plugins site so it looks promising in terms of uptake. If you are running the old version I whole-heartedly encourage you to upgrade. There are a lot of improvements and new features all of which I’m sure you will enjoy using.

Please also note that support is now only available in the open source area of my business forums. This means that blog comments, e-mails and IMs related to calendar support will be ignored. Using the forums allows people to search for a solution first and for me to place regularly asked questions in the FAQ.

Comments (2)    

Calendar 1.2 Release Candidate 1

After a slightly longer than expected break since the first beta release of Calendar 1.2 I’ve decided to go straight ahead and release the first (and hopefully only) release candidate of Calendar 1.2.

Since the beta phase I’ve made improvements that not only fix all the bugs that were logged in comments but I’ve fixed a few others that I found along the way, tweaked some of the things that I didn’t feel were quite right and squeezed in some new features – some of which were originally going to have to wait until version 1.3!

The added features since the last release are as follows

  • Mini pop-up calendars in the admin panel to assist with choosing correct dates
  • Full categories system to allow events to be grouped by type (off by default)
  • Categories key is displayed below the calendar when categories are enabled
  • Events can now be links as well as mouse-overs
  • Items listed in todays events/upcoming events now sport links and mouse-overs.
  • Small tweaks to the style and display logic to improve the standard look
  • Issue of times not displaying according to WordPress settings fixed
  • Issue of extra padding/blank titles on the widgets fixed
  • Issue of mouse-overs not working in IE6 fixed

You may well notice other improvements which have escaped my memory.

Users of Calendar 1.2 beta will be pleased to discover that I decided to provide an upgrade path after all and so you should find that all you need to do is replace your current calendar directory with the new one and you should be away. The same of course applies to users of the current main release (1.1.2) but you should follow the upgrade instructions in the readme.txt file carefully in this case.

Please provide all feedback and any bug reports in the comments of this post. Please do not post feature requests. The release available in this post will be the final release if no bugs are found. If bugs are found they will be fixed and then the final version will be released. No new features will be added until the next major version.

Oh yes and how could I forget, you can download Calendar 1.2 Release Candidate 1 here.

Comments (18)    

Widgets : Help or Hindrance?

I’ve been using WordPress as a CMS in many of the new sites I commission however I’ve always been willing to make modifications to themes and plugins to achieve what I want. WordPress is free software. In my book this means that I should expect to have to make changes to how things work to get everything I want. I’m not paying anyone so its not someone else’s responsibility to make the code do specifically what I need.

Widgets hail a new breed of free software users. Those who do not know how and do not want to know how to make their own modifications to site layouts or styles and yet still expect someone else to make it possible for them, indeed in some cases harass them to do so. Sure widgets are nice. They allow users to drop things in easier and not always having to edit files is a bonus. But someone has to code them, and no one configuration will be right for everyone.

By promoting an architecture that allows anyone to make what were traditionally code based changes to a site we up the ante on developers to provision these things in the first place. Lets not forget that these developers are writing for free and perhaps release something for the common good rather than with a desire to support every user’s whims. Further more there is still the hope that we can support old versions and the differing way with which widgets work make doing so increasingly harder.

So if there is a widget you use but are not 100% happy with, why not thank the developer for making your life easier and then look in the WordPress Codex for how to make the changes you want. Waking up to 30 complaints in your inbox is enough to make any developer want to hang up their keyboard. Waking up to 30 messages detailing the wonderful and amazing ways your free software has been modified and implemented in interesting and exciting ways is enough to make you want to extend your working day to better provide for these innovators.

Comments off    

WordPress Security Stupidity

I was reading a blog the other day and because the author had made reference to my calendar plugin I decided I would like to comment on the article. The site was setup so I had to register in order to post. I did so and was able to login and make my comment immediately – I wasn’t required to verify my e-mail address. I was also able to modify my credentials in a stripped down admin panel and it was here that I noticed something stupid.

Splashed across the top of the panel was a notice saying “This WordPress installation is out of date. The latest version is 2.5.1. Consider informing the administrator”. I considered shouting at WordPress for their stupidity with respect to security. If there is one thing we should learn from the telnet/SMTP hacks of days gone by its that shouting out that you have a vulnerable installation on some kind of banner is a bad thing to do. Luckily I’m on of the good guys and didn’t decide to compromise this individual’s site. Someone might do in the future though, with that site or any other displaying such a readily available banner. Why does this banner need to be there? Sure, it might need to be for an admin user but someone who has just registered? No. Sheer madness.

Comments off    

More of the same

Could this round of plugin updates spell further breakages for those running WordPress legacy? Given the admitted lack of testing on anything below 2.5, something is highly likely to go wrong with at least one of these plugins.

I’m sure Lester’s efforts to release these updates will be well received, after all I use a number of his plugins and have had to hack around with some of them to get them working and have noticed a degree of unnecessary code duplication as well – I’m sure I’m not the only one. Its just a shame that yet again we have an update in which legacy support seems to be lacking.

Comments off    

Calendar 1.2 Beta 1 Release

So, here it is, Calendar 1.2 Beta 1 finally seeing the light of day! I’d like to thank everyone for their patience in waiting for this, I hope after giving it a try you will feel the wait has been worthwhile. The final release will come two weeks from today, after people have had a chance to test the software and report bugs in the comments field of this post.

So, before I get to the actual release link, some house rules. There will be no support for this release. If you choose to use it live, that is your shout, but if you break something or someone hacks you, its your fault and you will have to deal with it. What I am after here is bug reports and comprehensive testing. Comments about how well the tests are going, problems, bugs, security flaws are welcome. Such comments should be made in the comments field of this post only, nowhere else. I’m not taking comments and questions by e-mail because there will most likely be too many. Thanks for understanding!

Ok, so the Calendar 1.2 Beta 1 release is here. Instructions are in the readme.txt file, please read this first, especially if you are upgrading. If you are upgrading you should ensure you backup your blog and your current install of Calendar, including the database. You may very well need this if there are unforeseeable problems, or if there is an issue with the beta such that the upgrade feature fails and causes problems. Again, you test this at your own risk and while I can’t see any problems with it at my end, that doesn’t mean you won’t. If you find a problem, report it, I’ll fix it.

A final note is that those of you with keen eyes will note the Event Categories feature is missing. I don’t have much spare time as you all know so I’ve decided to leave this out of the beta because I don’t want to release something which I know to have issues due to the lack of time spent on it. During the beta phase I will work on this feature and it will make it into the final release. If testing is required of this added functionality then a beta 2 will be released instead of the final version in two weeks meaning the absolute final release will be 4 weeks from now. I hope however that because the categories feature will use much of what is being tested in the beta already, an additional beta will not be necessary.

Comments (115)    

Calendar Sneak Preview

I’m now running the development version of Calendar 1.2 on my publicly visible development server. You can see it running on Lara here. Comments are of course welcome, those who suggested features will no doubt spot some of them in action. Two screenshots are shown below to give you an overview of the new admin panel which you are not able to see on the development site.

Some keen eyed viewers will no doubt notice from what is visible that only one feature, “Event Categories”, as mentioned in one of my previous posts, remains to be implemented. Its close folks 🙂

Calendar Management Screen

Calendar Configuration Screen

Comments (11)    

Top 100

So it looks like my Calendar plugin is in the top 100 list of WordPress plugins. This is a pleasant surprise and makes me wonder how much higher up the list the plugin might go when the new features go live. Thanks to all who use my plugin and have offered suggestions for its future development – its success is down to you.

In the light of seeing the plugin about to hit 10,000 downloads I’ve decided that the beta of the new version will be released when the 10,000 figure is hit. Comments will be invited from users on the blog post announcing the beta and any bugs reported will be fixed. When two weeks of beta testing have elapsed, the new version will go live 🙂

Comments (3)    

Next entries » | « Previous entries