Extending WP Help to users who can’t edit_posts

Yesterday I was explaining how I created a user role to edit a particular post type and only that post type. Today I want to show how you can use Mark Jaquith‘s excellent WP Help plugin to support these users. The issue I wanted to solve is that a freshly installed copy of WP Help …

Capabilities for custom post types in WordPress

I’ve just had to break out some serious Capabilities in WordPress today, and I’m documenting the process here in case it helps me in the future (or the past, though it seems unlikely) or anyone else. The scenario i: I have a custom post type (Video) and I want to allow Editors and Admins to …

Escaping lists of strings for SQL in WordPress

Today I found myself wanting to use a query similar to SELECT DISTINCT post_id FROM $wpdb->posts WHERE meta_key IN ( ‘string_x’, ‘string_y’, ‘string_z’ ), but where I needed to construct the values for the list of strings from an array of untrusted values (because we never trust inputs, we always look suspiciously on them if …

Dragging, dropping and sorting, with jQuery UI

I spy a nice opportunity to document some jQuery UI functionality I’ve been playing with this afternoon, for a soon-to-be-revealed client project. The project needs photo galleries, and as these need to be tied into the other custom post types and taxonomies, I’m quickly rolling my own so I can completely control the experience for …

Laying out a grid in WordPress

For a recent project, I needed to lay items out in a series of grids, sometimes three columns, sometimes more. The CSS provided by the designer looked something like this: I could have used jQuery, or some of the more advanced CSS selectors, to achieve this, but here’s what I created as a custom WordPress …

Dealing with sold out products and the PayPal BMSetInventory API method

I’ve just built a WordPress custom post type which allows you to sell a few simple products on your site by interacting with the PayPal Button Management API. (It wasn’t easy. PayPal’s documentation is full of duplicated informal, distributed all over the place, and badly maintained.) One thing which isn’t mentioned in the documentation is …

Handy sendmail debugging commands

Some sendmail commands I’ve just found useful, but couldn’t locate on Google. Get the current status of a message in the queue: grep  ‘james@example.com’ /var/log/maillog Get the headers for an email: cat /var/spool/mqueue/qf[message ID] Get the body of an email: cat /var/spool/mqueue/df[message ID] (Many thanks to my old friend Mr Matt Westby for his help with …

Gravity forms access for editors

Gravity Forms is an excellent WordPress plugin, which allows flexible and easy control and creation of pretty much any kind of form in your website. Behind the scenes it has a very flexible integration with the WordPress system of roles and capabilities, which governs who can do what in your admin area.

Some security suggestions for WordPress (and other) sites

Someone on the Manchester WordPress User Group mailing list recently asked about checking their WordPress site for malware, and as I’ve spent some time decontaminating a WordPress site which was fairly riddled with malware recently, I thought I’d write up some quick pointers which might help you (or me in the future). I’ve broken them down …

Trust your gut, also use SMART Utility

For a while now my laptop has been running *extremely* slowly. Recently it got worse and about every other startup would just freeze until I forcibly powered down and tried again. I ran Apple’s Disk Utility and told it to check the error messages from the drive’s internal SMART systems: “this drive is verified”. I …