Social posting from WordPress

Now that composer is shutting down, I’m looking at how to send posts to Facebook, Twitter, and maybe LinkedIn while keeping the original here on my WordPress site.

The most “official” option is JetPack from Automattic, the makers of WordPress. It’s easy to setup, but it doesn’t work perfectly on Twitter for my setup. I spent today trying options, including this plugin. The plugin is a bit complex to setup, but is super powerful. You need to pay for Google+ support though.

The only change I wanted to make to Jetpack was to use the post content as a title on Twitter, when there is no title. So if I post a status update with just a body, that should go to Twitter, not an empty title an a link to the blog post.

I started here. Turns out that approach doesn’t work. Or at least, after 4 hours of debugging, I couldn’t get it to work. No, in fact, I’m 90% sure it doesn’t work after I finally read the Jetpack code. Wow, what a time sink that turned out to be.

Finally, I got it running. I use the publicize_save_meta hook, check if we’re publishing to Twitter, and if we are, and there’s no post title, and no custom message already set, I set the custom message to the post body, trimmed.

Deleting WordPress spam comments in MySQL

Working on a project with more than 200k spam comments in the WP database. Trying to use the “empty spam” button in WordPress just doesn’t work, it deletes a few tens of thousands before hitting the 30 second PHP timeout.

I searched around and found a few suggestions to delete from the wp_comments table. However, that ignores the 3x as many rows in the wp_commentsmeta table if you’re using akismet. This query does the job, although for 200k comments it does take a while!

DELETE c, m FROM wp_comments AS c LEFT JOIN wp_commentmeta AS m ON m.comment_ID = c.comment_ID WHERE c.comment_approved = 'spam';

WordPress patches

The upgrading mechanism in recent WordPress version downloads an incremental upgrade zip file. I couldn’t find anything online to get the urls, so I dug into the code and I’m posting here.

The upgrade from 3.3.0 to 3.3.1 was in the file I’ll try to remember to update this post as future versions come out. I’m not sure of the exact file format. I think it’s -partial-0/1/2 to mark how many minor versions back the upgrade goes.

Personally, I use these files for minor upgrades because it’s faster, but I use the full download file for a full version upgrade.

Update for 3.3.2: It seems that contains the changes from 3.3 to 3.3.2 and contains the changes from 3.3.1 to 3.3.2.

A WordPress hosting cooperative

Maybe you make WordPress sites for cash. Maybe you design themes or write plugins. Then, after your work is done, your clients (or friends, lovers, etc) need to be supported. Somebody needs to keep WordPress and her plugins up to date, secure, and backed up.

Would you like to share that load with some co-cooperators in a WordPress hosting cooperative? Imagine a small group of developers collectively managing 50 or 100 WordPress sites instead of individually managing 10 or 20.


Ok, you’re sold on the vision, what about the details?

Initially, a loose association of a few individuals, no legal structure. I’m willing to act as the banker for the startup period. I’ll register a domain name and pay for a few servers. I promise to transfer ownership of the domain and any other assets when (or if) a legal organisation is created at any point in the future. Or, if I choose to move away, to transfer the domain and other assets to another person in the group.

My suggestion is that we adopt a split pricing model. We set a fair market price for customers. In the beginning, it’s probably simper to charge per blog irrespective of traffic, disk or cpu usage. We can change this policy as soon as we need to.

Members then pay a pro-rated share of costs based on their number of sites. For example, we have 10 customers paying $10 a month, $100. Expenses are $150 a month, we have 5 members with 4 sites each, $50 over 20 sites, each member pays $2.50 per month per site.

To distinguish between customer and member sites, we can say if money changes hands, it’s a customer site. So a member might pay for 8 of their client’s sites at customer rates, and 3 for their family at member rates. The distinction is whether or not the member receives cash from somebody for that site. We trust each member to be honest.

Payment optional

It’s not as crazy as it sounds, honest! I suggest we adopt a post-paid, payment optional policy. At the end of each month, we send invoices marked payment optional. Customers can choose not to pay and their sites will be taken offline in reasonable time period.

The advantage of this model is we don’t ever have to deal with refunds, price disputes or otherwise. If the client is happy with the service they already received, great, if they’re not, they don’t have to pay and we part ways amicably.


  • Transparency: All financials are publicly visible.
  • Profits: Until we have a legal organisation, any profits are kept in the group to pay for expenses. No payouts to members until the legal structure is sound.
  • Do-ocracy: Until we decide to change it, we each contribute what we can and what’s needed to keep the system online.
  • Respect: Inspired by the Ubuntu project, in joining the group, we each commit to treat other members and customers with the utmost of respect at absolutely all times.

Next step

These are my initial thoughts as I wrote this post in half an hour. If you’d like to join the discussion, become a member or a customer, post a comment below, shoot me a message, or otherwise open the communication lines. 🙂

Switching to twentyten

I’ve just upgraded to WordPress 3.0 and switched to the brand new default theme called twentyten. If you’re reading this in your feed reader, come by and check out the new look.

I’ll update my picture (people seem shocked when they see it after meeting me in person!), and modify the menu using the new menu editor. I’ll try to make navigating a little easier. If you haven’t already tried it, I recommend the new version of WordPress.

Proposing WP Flavours

Instigated in part by this discussion, I think the time has come to start forking WordPress. I think there is space for a few different forks, or flavours, of WordPress. I can imagine flavours focused on security, privacy and probably others. For example, a flavour that disables all the post versionining. A flavour that strips out other parts of the code to suit a specific need.

To serve these aims, I propose to create wpflavours (or wpflavors). I imagine a site where flavours can be downloaded, an svn repo where patch sets can be maintained (maybe using quilt), and potentially a mailing list for group communication. Maybe we could host the whole thing on google code or some other public code / svn service. I suspect we’ll need server space to automate the patching and packaging process though.

If there’s sufficient interest (say anyone else interested in writing patches), I’ll register the domains, setup a simple WordPress site, figure out svn, setup a mailing list, and we’ll see what happens. If you’re interested comment publicly below or get in touch privately.

bbPress 0.9 and WordPressMU 2.7

I’ve just integrated cookie logins between bbPress 0.9.04 and WordPressMU 2.7.1 fort the second time. It took me a while to remember all the steps that were necessary the first time, so I’m documenting them here.

This is a quick and dirty integration. There might be a more fanciful or secure way of doing this. It works (for me, no guarantees!) and it’s easy. I think it will work for WordPress and WordPressMU but I’ve only tested on WordPressMU.

Firstly, you need to sync all the key and salt values in wp-config.php and bb-config.php. Set them in bb-config.php first. You need two lines like this:
define('BB_SECRET_KEY', 'secret_key_here');
define('BB_SECRET_SALT', 'secret_salt_here');

Generate secrets here.

The next step is to copy those values into wp-config.php. Copy the secret key value into all of these lines:
define('SECRET_KEY', 'secret_key_here');

Then copy the secret salt value into each of these lines:
define('SECRET_SALT', 'secret_salt_here');

It is possible for these to be different on WordPress. That means each cookie will be different. WordPress uses 3 cookies to handle logins. However, that complicates matters with bbPress, so for simplicity, keep them all the same.

You may also need to set COOKIE_DOMAIN and COOKIEPATH in bb-config.php. Check out your forum admin (Settings > WordPress Integration) and it will tell you what to do.

Now go to your forum admin, Settings, WordPress Integration. Click “Show manual config settings:”. Now copy that into bb-config.php. Change this line to:
$bb->authcookie = 'wordpress_logged_in_';

WordPress standalone uses a wacky cookie name, generated randomly, but WordPressMU does not. If you’re using WordPress, you need to change this value. Log into WordPress, check the cookies in your browser, and copy the name here. I think you can also do this by setting COOKIEHASH in your wp-config.php. See this article for more info.

Now when you log into WordPress, you’ll be logged into bbPress. When you log out of WordPress, you’ll be logged out of bbPress. But not vice versa. In order to complete the link so you can log in and out on bbPress, you’ll need to add a little plugin to bbPress. Get the code here and put the file in bb-plugins then activate the plugin via your forum admin. This plugin only works for WordPressMU / bbPress. If you want a version for WordPress, nag me with a comment on this post and I’ll see what I can do. 🙂

Now logins should sync beautifully. If you have any questions, try asking on the bbPress forums.

Another WordPress plugin

I’ve been on something of a plugin writing spree of late. I’ve just written my second WordPress plugin this week.

I realised that the timezone was wrong on this blog. It’s been wrong since I left Sydney. Now that I’m posting status updates, and not using the “posted X minutes ago” format, it’s obvious when my times are wrong.

I looked into how I could change the times on my old posts. In the process I found Otto’s excellent Automatic Timezone plugin. It sets your timezone automatically including changes for DST and so on. You just choose the nearest city and it does the rest.

However, I couldn’t find a plugin that would change the timezone information on older posts. So I wrote one. The first version ruined the posts, thankfully I had run a backup before I made 90% of the changes. This version seems to work fine. New page here, it’s still waiting for approval from the WordPress plugin directory.

So the timestamp on this post is correct for my current timezone, it’s 2:17am, time for bed!

Thinking bigger

Thinking bigger by HalonaCoast

I think Seth Godin’s is my favourite blog. His posts are short, concise and usually thought provoking. Seth avoids the mistake of writing too much, too often, and writing crap just to keep the content flowing.

Today Seth talks about thinking bigger. It’s got me thinking about StraightPress.

I host a handful of WordPress sites for family, friends and so on. Every time a WordPress update is released, I manually go through each site, run a backup, apply the update, then test the site. It’s a time consuming process, but it’s important to keep the sites secure. The sites are on my server, so security is my concern. It’s a bit like brushing your teeth. Important, but not always the highlight of your day.

This is where the idea for StraightPress was born. If I can manage a handful of sites, why not manage a few hundred sites, and generate serious economy of scale? Like a professional tooth brusher. We’ll come round to your house at 6pm every night and give your teeth a professional clean. Great I thought, here’s a business I can build that meets my criteria.

Recently I read the excellent book Scientific Advertising (pdf) by Claude Hopkins. The book was written in 1923 and is as relevant today as the day it was penned. It really is an inspirational read. It’s a book about caution, practicality, being realistic. It’ll never inspire you to create Google, Apple or Twitter, but like insurance, it will keep you safe, sensible and secure.

The book makes an excellent point about toothpaste. The author makes the point that tooth paste is easier sold on account of its beauty enhancement than its disease prevention. I do believe that is true. Offering a product that enhances, improves, enriches is a much easier sell than a product that prevents.

Why do you want your WordPress site kept up to date? One of the most important reasons is security. Preventing problems. But that’s not a great selling point. New features is another important point. WordPress 2.6 added post revisions. Every time you save a post or page, it creates a new version. So if you mess something up, you can easily go back to an older version. That’s a very powerful feature.

My question is, how do I think bigger? How do I shape StraightPress so the offering is oustanding, remarkable, notable. What can we offer, around WordPress hosting and management, that would make people sit up and say “Damn, I want me some of that”? I don’t have an answer today, but it’s a question that will be on my mind until I do.

WP Mail SMTP v0.7

I released version 0.7 of the WP Mail SMTP plugin a couple of days ago. To make support a little more manageable I’m going to switch the comments from the plugin page to a post for each version. So please ask in the comments here for all support questions related to version 0.7. If you’re using a previous version, please upgrade and then post your questions here! 🙂

Please be sure to look back at previous questions before posting here. If you’re having a problem where mails are not being sent, or anything of that nature, please post your debugging output. Send a test mail, then copy / paste the response into the comments. Remember to delete any passwords. I’d recommend you replace any @ symbols with something else (at), [at], #at#, etc.

WP Mail SMTP v0.6 released

Just released a new version of the WP Mail SMTP plugin. There were a stream of similar questions about one particular error message over the last few months. Hopefully this new version will provide more detailed debugging output. I’d recommend upgrading to anyone having problems. There are no bugfixes or security fixes in this update, so it’s not a priority release.

Update: I’ve released version 0.7 today as well. This version fixes a long-standing bug where the plugin would overwrite the from name and email, even if they had been set by another plugin (or WordPress itself). I recommend everyone update to 0.7 as soon as possible.

Upgrade to 2.3

I successfully upgraded to WordPress 2.3 today. There were one or two glitches to start with, thankfully I had a full backup and was able to restore it quickly. Second time round it went fine. I’m now using WordPress’s own tagging system. Alas my tag cloud is not quite as pretty as it used to be, I’ll work on that!

Burn Your Feeds, Burn Your Profits

I’m surprised by the continued success of Feedburner, the popular blog feed stats service. On the one hand, you get a great stats package, offload some traffic from your blog server, and it’s free. However, for those benefits, you give up control of your feed and you give up a share or all of the ad revenue.

With plugins like Google AdSense for Feeds WordPress users can put their own ads into their feeds. With a handful of feed stat plugins around, it must be possible to get all the benefits of FeedBurner without the downsides.

I suppose it’s one of those situations where they’ve “made it” sufficiently that using FeedBurner is the norm. That and they were just acquired by Google, uh oh, the G disease is spreading…

WP Mail SMTP v0.3

A few people reported problems with the WP Mail SMTP plugin. I’ve resolved a few bugs and added a new feature that allows you to set the From name and email address of all mail sent by the wp_mail() function. I’ve thoroughly tested this version (unlike previous versions, oops!) and I’ve released it for immediate update.

Please note: SMTP authentication does not work in version 0.2, I encourage all users to upgrade immediately.