Hapless band of staff and regulars

Archive for the Plugins category

Sunday 9th March 2008

Twitter fun

This weekend I have been mostly playing about with Twitter.

First I created a CNPS (Consecutive Number Plate Spotting) TwitterBot. The bot watches for @ and d messages to it, it then adds the plates to my database. Anyone with a Twitter account AND and Artesea account can get it to work, just visit the mashup page here for more info.

Next I managed to exceed the weekly allowance for tweets to my mobile. Think it was something to do with a large number of followers at Conference.

And just now I’ve installed a New Post -> Twitter plugin. This one seems to be one of the best as it’s run from my webserver (doesn’t require frequent polling of the rss feed), and it has the option to enable/disable tweets for draft, edits or new posts, so unlike other who have similar plugins you should only get a tweet from my blog when I hit Publish.

Friday 9th November 2007

Hide from all except admin

I wanted to put a WP-Admin link on my blog, but one which only showed to me whilst I was logged in.
So hunting through the WordPress Codex I tried to find something like is_admin(), but couldn’t find it. Then going through all the PHP files I found this function current_user_can(capability) which returns true or false if the logged in user can do that capability. Next I had to work out a capability which only admin could do, but a quick look at the source code showed that it should be possible to enter an integer which related to a level.
So finally I have this on my blog:
<?php if(current_user_can(10)) { ?><a href="/wp-admin/">WP-Admin</a><?php } ?>

YouGov

Thursday 8th November 2007

Tidy Slugs

I’ve been playing about with WordPress plugins all day, and have created (more like stolen and modified a small amount) Tidy Slugs.
This plugin tries to catch a few of the random stuff that WordPress misses when I make the post slug.

For example if my post title was:
Ryan’s Tidy Slugs, WordPress would make a URL of blog.artesea.co.uk/2007/11/ryans-tidy-slugs.html

however if it was:
Ryan’s Tidy Slugs (notice how the apostrophe is slightly more curvy) it would be blog.artesea.co.uk/2007/11/ryan%e2%80%99s-tidy-slugs.html

Very, very ugly!

(OK, you might not be able to spot the difference as WordPress loves to curve the apostrophes, however try creating a post title using the second one).

GooSync