v0.7.2: Custom statuses for contributors

Thanks to an awesome contribution from Daniel Chesterton, we have an oft-requested feature to give you today: custom statuses for contributors. Previously, your contributors and other users without the ‘publish_posts’ capability had two options, “Save as Draft” or “Submit for Review”. With Edit Flow v0.7.2, they can save content to any stage of your workflow.

Here’s what the submit meta box now looks like for your contributors:

You can use a simple filter to restrict your contributors to only changing specific statuses. If you did so, it would look like this:

In this release, we’ve also incorporated the following changes:

  • Support for trashing posts from the calendar. Thanks Dan York for the idea and a bit of code.
  • Updated codebase to use PHP5-style OOP references.
  • Fixed some script and stylesheet references that had a double ‘//’ in the URI path
  • New edit_flow_supported_module_post_types_args filter allows you to enable custom statuses and other modules for private post types

See Github for all of the closed issues.

As always, please hit us with questions, feature requests, and bug reports in the WordPress.org forums. If you’d like to help out, check out our guide to contributing.

Edit Flow v0.6.5: Fixes post timestamp issue when using custom statuses

Out just a moment ago, Edit Flow v0.6.5 has one purpose: to fix an issue with the post timestamp being set when you set a post to a custom status.

Basically, if you set a post or a page to a custom post status, the publication timestamp would be set and saved. Upon publication of the piece, the publication date was set to whenever you originally saved the post with a custom post status. Our fix works around some of the limitations of WordPress core on this issue.

WordPress.org user saomay deserves our thanks for their patience in helping track down the issue, and testing the fixes. It was originally reported in the forum.

It’s worth noting that we’re actively working on v0.7. You can follow our discussion on our development blog. We’ll be looking for beta testers, translators, and documentation writers shortly. If you’d like to help out, let us know in the comments.

Code Sample: Filtering Custom Statuses by Role

We’ve received a number of requests from Edit Flow users asking for the ability to limit statuses to specific roles. While this isn’t possible via the WordPress admin, you can write a bit of code to implement this. Just add the following snippet to the functions.php file of your active theme and modify as necessary.

The code sample limits authors to only set ‘Draft’ and ‘Pitch’ statuses, whereas editors (and administrators, by omission) have access to all statuses.

 -1,
	'author' => array( 'draft', 'pitch' )
);

add_filter( 'ef_custom_status_list', 'ef_x_filter_statuses_by_role', 10, 2 );

function ef_x_filter_statuses_by_role( $statuses, $post ) {
	global $role_status_map;
	
	$role = ef_x_get_user_role();
	if( isset( $role_status_map[$role] ) && $role_status_map[$role] != -1 ) {
		$statuses = ef_x_filter_by_value( $statuses, 'slug', $role_status_map[$role] );
	}
	
	return $statuses;
}

function ef_x_get_user_role() {
	$user = wp_get_current_user();
	return array_shift( $user->roles );
}

function ef_x_filter_by_value( $array, $property, $value ) { 
	$filtered_array = array();
	foreach( (array) $array as $index => $item ) { 
		if( isset( $item->$property ) ) {
			if ( ( is_array( $value ) && in_array( $item->$property, $value ) ) || $item->$property == $value ) {
				$filtered_array[$index] = $item;
			}
		}
	} 
	return $filtered_array; 
}

v0.5.1: maintenance release

We tagged a maintenance release on Wednesday evening that cleaned up a few rough ends in v0.5. These include:

On Wednesday evening, I also had the chance to update our roadmap to 1.0. The next scheduled release is 0.6 and will feature such awesome goodness (we hope) as better support for custom post types, custom task lists, and a refactored editorial calendar with story budget view.