Fix users with no role – data migration plugin

So you’ve migrated a bunch of users over from another system and then, horror, you discover that they don’t have roles in WordPress. The WP Users admin screen doesn’t cope with this issue (why should it), so the only option would be to go through and manually select the roles for each user with no role… fine, right? Except I just migrated 8,000 ish users and there’s no way my meta carpels will take that abuse. This plugin finds any users on your system with no role and gives them the role of ’subscriber’, it does this in batches of 1,000 users per page load and once it has finished it replaces your entire blog with a message saying it’s finished… so don’t leave it running unattended kids, eh? (I know that’s rude, but coding “echo ‘blah; exit;’ is SO much quicker and it’s only a dirty data migration tool.

You can download the source here: Fix Users with No Role – Data Migration tool as WordPress plugin

Migration to bbPress – fix topic slugs

So I’ve just had to migrate a whole load of data to bbPress, and unfortunately the fairly old migration tool I was using (while generally excellent) didn’t bring across the topic-slugs, meaning I couldn’t have pretty permalinks in bbPress. So I’ve written a quick plugin which creates the topic slugs, it does this by doing 1000 at a time every time the page loads, then it very rudely bangs up a big text notice telling you it’s done and you should remove the plugin… at this point bbPress won’t work until you remove the plugin. You have been warned. I couldn’t be bothered with polite messages as this is a one use migration tool. :)

Here it is: bbPress create topic slugs plugin – data migration tool only

Updated version, this one also create forum slugs: bbPress create forum and topic slugs plugin – data migration tool only

Installing ImageMagick on MacPorts and imagick on PECL

Over the last few hours I’ve installed ImageMagick on MacPorts (super easy), and imagick on PECL (not so much). Xentek’s post on ImageMagick and imagick was a great help, and got me past the first brick wall I hit (passing in the ImageMagick prefix to prevent it complaining about Wand-config)… but then I couldn’t get the darned extension installed. Anyway, here’s the steps I went through, and if anyone has any suggestions for improvements I’m all ears. Continue reading ‘Installing ImageMagick on MacPorts and imagick on PECL’

Editing many posts at once in WordPress

Need to edit many posts at once in WordPress? Is the standard limit of 15 posts on the Posts Edit screen just not enough for you? Well, there is a hack you might be interested in. This involves editing the core WP files, so is not recommended as a permanent solution or for production sites… it works for me, but it might kill your cat and devastate the area around your home. You have been warned. Continue reading ‘Editing many posts at once in WordPress’

Restoring deleted files from an SVN repository

I’ve always idly thought that one of the brilliant things about version control was that you could recover accidentally deleted files when it became necessary. Well that scenario arose today, and I realised I had absolutely no idea how to do it. Continue reading ‘Restoring deleted files from an SVN repository’

Individual languages for WordPress Mu sites

For WordCamp UK 2009, we’re having a dual language site (currently in the works, but hopefully near completion soon), where the content will be available in English or Welsh (as our host city is Cardiff). I had a scout around the various multi-language plugins, and none of them really seemed to hit the spot (mostly because there seemed to be too much UI jammed onto the screen), so I’ve decided to go with WordPress Mu running with a sub-directory for each language.

Continue reading ‘Individual languages for WordPress Mu sites’

WordCamp UK 2009, theme translation file

WARNING: Of interest only to those involved in translating the Wordcamp UK 2009 theme into Welsh!

WordCamp UK 2009 POT file – for translating the theme into Welsh (or any other language). For more information, see the WordPress Internationalisation information.

Page load hooks in the WordPress admin area

There are a number of really handy hooks, each of which are specific to a page in the WordPress admin area. You can use these action hooks to enqueue scripts on particular pages, to process form requests, etc, etc.

Despite these hooks being so handy, and despite using them a great deal, every time I want to use one I have to dig through the code to try and work out how they work and what they’re called… so for my own benefit, here’s what I think is a complete list: Continue reading ‘Page load hooks in the WordPress admin area’

Problems with Time Machine endlessly preparing

We use Time Machine with a network disk connected via AirPort Extreme for backup in our household (writeup), and it’s generally a great solution. However recently my wife’s laptop had got stuck in an endless “preparing backup” situation. There didn’t seem to be any significant details in the error log, and when I ran a Disk Utility on the Sparse Bundle associated with her laptop nothing came up. My laptop was backing up over the network from the same drive, so I was fairly sure everything was working with the setup.

After a fair bit of googling I came up with Patty Patty’s solution (scroll down to Patty Patty’s post on Jun 1, 2008 12:45 PM) on the Apple discussion boards which I’ll rekey here for convenience:

  • Turn Time Machine off
  • Trash the com.apple.TimeMachine.plist in /Library/Preferences
  • Restart

I then turned Time Machine back on, and the next backup ran fine. Bear in mind that although this worked for me, any issue you have may be different and your mileage may vary. Patty Patty (gender unknown) went on to suggest the following, although I didn’t need to go this far:

  • Full Spotlight reindex of the Macintosh HD
  • Added a bunch of folders to the “Do Not Backup” list in Time Machine
  • Turn Time Machine on

The one difference I could spot between my wife’s setup with her laptop (which had the issues) and mine (which didn’t), is that her network connection is almost solely wifi and mine is often ethernet. Some other reports I read suggested that when connections are interrupted over wifi it can screw with Time Machine. Other reports I read suggest that Apple may still be working on this in upcoming releases… but given Apple’s usual level of transparency and predictability I think we should all take that one with a pinch of salt.

Hope this helps someone.

Custom taxonomies in WordPress

I’ve spent quite a bit of time over the last week getting to grips with custom taxonomies in WordPress, and I’m really pleased with what I’ve found. A taxonomy is a classification, and WordPress already has two taxonomies buil in: tags and categories. Categories lean towards a more formal taxonomy, which you might setup with forethought and some planning, whereas tags lean more towards a more casual folksonomy, which you might construct “on the wing” in a less formal and more ad hoc style. WordPress uses a generic taxonomy setup to create the tag and category taxonomies, and you can use the same functions to create your own taxonomies.

I’m going to take you through the process of creating a basic taxonomy, creating some terms in it and relating those terms to some posts. There’s some demonstration code in the form of a proof of concept WordPress plugin, which you may find helpful.

Continue reading ‘Custom taxonomies in WordPress’