Yeepee, it’s that time again. During the whole month of July, I’ll be mostly offline: sporadic infrequent internet access to check any urgent email, but probably no activity on this blog. That means no code update, no great stuff for WordPress, no support for my plugins. I’m on the beach with my kids :)
Way back in 2005 someone said “Email is the universal API“. This is what came to my mind when I found out and tried Posterous, a blog-by-email service. I think this service has a lot of potential for casual bloggers, and already has a few rather cool features regarding media embedding.
Blogging by email has always been a core feature of WordPress (or at least I think so, been a user since 1.01) but it has never evolved. You can’t assign categories, you can’t tag it, you can’t embed images or any other kind of attachments. You can’t do anything but raw text, which is sort of lame.
I think there are definitely a few features the WordPress folks should steal and improve from Posterous. WordPress has a nice gallery feature, right? Interface it with blog by email. WordPress knows podcast: make things so that when you email an MP3 it’s added as a streamlined or downloadable audio track. Basically, WordPress does anything, anything should be doable via email.
A powerful blog-by-email feature would be great for WordPress (and a killer thing to add to wordpress.com too). I’m not always near a web browser with a (non firewalled) internet connection, but I almost always have an email client in the vicinity.
Any thoughts, readers? Did you ever, or would you, use a blog by email feature ?
Related posts
A WordPress install is a bunch of directories and files, but two of them are particular: the file wp-config.php and the directory wp-content/ are personal and don't get overwritten when you upgrade your blog. In WordPress 2.6, they get so personal that you can even move them out of the WordPress root. This must bring a major change to your coding habits.
Plugin coders sometimes need their script to guess the location of their own directory (for example to require() files), or to include wp-config.php to make a file live alone in a WordPressized environment.
Guessing the path of wp-content
WordPress 2.6 allows advanced users to specify the location (physical and URL) of this directory with a constant define, so the directory might not be where it used to be.
What you used to do:
-
$plugin_path = ABSPATH . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));
-
$plugin_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));
What you will have to do, now that this directory can hide anywhere:
-
// Pre-2.6 compatibility
-
if ( !defined('WP_CONTENT_URL') )
-
define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
-
if ( !defined('WP_CONTENT_DIR') )
-
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
-
-
// Guess the location
-
$plugin_path = WP_CONTENT_DIR.'/plugins/'.plugin_basename(dirname(__FILE__));
-
$plugin_url = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__));
In WordPress 2.6, constants WP_CONTENT_DIR and WP_CONTENT_URL are either user defined or set in wp-settings.php
Including wp-config.php
In WordPress 2.6 you can either leave wp-config.php in the blog root directory, or move it to the parent folder (which makes sense if this takes this critical file off of the webserver's document root)
What you used to do:
-
require_once('../../../wp-config.php');
What you must do now:
-
$root = dirname(dirname(dirname(dirname(__FILE__))));
-
if (file_exists($root.'/wp-load.php')) {
-
// WP 2.6
-
require_once($root.'/wp-load.php');
-
} else {
-
// Before 2.6
-
require_once($root.'/wp-config.php');
-
}
Basically in WordPress 2.6 the file responsible for loading the environment is, in first instance, wp-load.php in place of the good old wp-config.php.
However, as pointed out by GamerZ in the comments, this still may not work. Why? Because not only the config file may not be there anymore, but the relative path to it may have changed since wp-content might have been moved too.
At this point though, there is no way I can think of to guess the locations of both wp-config and wp-content. To be 100% foolproof, such a "standalone" file needing to include wp-config should be editable so that advanced users moving their wp-content directory could manually edit a location path (the $root variable in the previous example)
Summary
Coders, revisit your old plugins to make sure they won't eventually break on WordPress 2.6 :)
Related posts
Stephen, on his geek blog Nerdaphernalia, is running a series of excellent posts giving advices to plugin authors for neat subtle effects: adding a "Configure" link right next to the "Activate" link on the Plugins page, or how to give credit to your plugin without cluttering the page (I'm a big fan of the "Configure" link trick, that I've added to my latest release of Better Feed and will definitely implement in all my plugins now)
What's coming next on Stephen's blog is what seems to be my biggest pet peeve regarding plugins: saving plugin settings without cluttering the option table. I've had a draft post here for about 18 months about plugin coding tips and guidelines, and for sure its main point would be: "for f*ck sake, why don't you save all your options into just one array into just one entry??"
Taken from an actual plugin (slightly changed for anonymity) randomly found on my test blog (warning: NSFW)
-
/*Lets add some default options if they don't exist*/
-
add_option('xxx_email', get_option('admin_email'));
-
add_option('xxx_subject', 'From Website');
-
add_option('xxx_success_msg', 'Thanks, your email has been sent!');
-
add_option('xxx_error_msg', 'Please fill in the required fields');
-
add_option('xxx_error_msg_2', 'You have not entered a valid email address');
-
add_option('xxx_error_msg_3', 'That destination does not appear to exist');
-
add_option('xxx_redirect_loc', get_option('siteurl'));
-
add_option('xxx_redirect_time', '3');
-
add_option('xxx_css_inject', '1');
-
add_option('xxx_cc_myself', '1');
-
add_option('xxx_user_subject', '1');
Arrrgh. When I look at a plugin for the first time, the very first thing I do is literally count the occurrences of "add_option". More than 3 and the plugin is a no-no on my blog.
Executive summary: read Nerdaphernalia (I mean, if you're not a subscriber of Planet WordPress already). And wait a few more months for my "10 stuff to do to write proper plugins" article :Þ
Related posts
The mother of all the feed plugins is back: Better Feed version 2.0 just hit the repository and it's now even better than better.

For those who don't know it, Better Feed allows you to highly customize your feed, adding basically anything you'd like below each item: a copyright notice, an "Add to delicious" link, a promotional message, tag links, incoming links in Technorati or Google, you name it.
It also makes your feed comply to the "Read more" link, just like your blog posts: you'll be able to tease your readers and keep some surprise off the feed.
This long due update brings a very neat interface with real time preview -- no more dirty coding in the plugin file itself. It's for WordPress 2.5+ and is completely happy with 2.6 as of today. Get a Better Feed today!
Related posts
According to this non-authoritative poll, nearly 50% of Firefox3 users think that the "Awesome Bar" is a huge piece of crap.
I must concur: this is a *huge* piece of crap. The sad thing is, there seem to be no way of reverting to a normal behavior. A few Firefox Addons or about:config hacks make things look like what it used to be, but unfortunately it does not act like it should.

I'm almost tempted to downgrade from FF3 back to FF2.
Related posts
For nearly 3 years now, all my online activities including this blog have been hosted at DreamHost. Nearly 3 years of overall positive experience then, otherwise I'd be obviously somewhere else :)
The reason of this post is that I've just received five DreamHost invitation codes, that are worth the following:
- 4 times the normal disk and bandwidth (that is: a ridiculous 2TB disk and 20TB bandwidth)
- $150 off the five-year plan
- $200 off the ten-year plan
- ... and a nice incentive for me (because, yes, Dreamhost's promotional stuff is another feature I love and a reason why I recommend them)
So, if anyone want to sign up(aff. link) with them and become a happy co-hostee of planetOzh, feel free to use one of these 12-digit codes:
145273429970
407283541102
885924571160
531143567587
847528798894
(each one can be used once, so if you plan to use any, do it now)
And if anyone is not willing to sign up with Dreamhost, just ignore this post :)