Code Sample: Changing the number of posts on the Story Budget

We received a question from Quint Randle about how to customize the number of posts displayed in the Story Budget view of Edit Flow (which is 10 by default), so I thought I’d write up a quick tutorial here. It’s simple, and enabled in Edit Flow by this bit of code.

To increase (or decrease) the number of posts from the default of 10, just add a small code snippet to the functions.php file in your theme. For instance, the following would increase the number of stories shown per category to 20:
[code lang=”php” title=”Change the number of posts displayed on the Story Budget” light=”true”]
add_filter( ‘ef_story_budget_query_limit’, create_function( ”, ‘return 20;’ ) );
[/code]
Just modify the ’20’ above to whatever number of posts you’d like to see in the Story Budget view. And voilà!

Of course you could split out the create_function call above to actually use a function that you’ve defined elsewhere in your functions.php file, but unless you’re going to have complicated logic to decide how many posts to display, I don’t see the need for anything beyond that one-liner.

Any further tutorials you would like to see on our blog here? There are lots and lots of filters baked into Edit Flow that are just dying to be unlocked by you, our users—let us know in the comments below what you’d like to customize or see in action and we’ll do our best to explain how to use it! And as always, for support questions, please post your question here.

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; 
}

Edit Flow v0.6.1: Custom post type support and minor improvements

We released Edit Flow v0.6.1 yesterday. While the version number suggests a minor upgrade, we’ve put a lot of work into this release and have a number of new features, improvements and fixes that you’ll enjoy.

Note: Edit Flow v0.6 and above requires WordPress 3.0

Custom Post Type Support

Edit Flow now supports Custom Post Types

Edit Flow now supports Custom Post Types

It’s a feature many of you have been asking for since Custom Post Types were added in WordPress 3.0. We’re happy to announce that Edit Flow is now custom post type-friendly. You can easily add or remove any Edit Flow feature to your custom post types with a few lines of code. We’ve included some code samples to get you started.

Note: Custom post statuses are now enabled for pages by default as we’ve removed the option from the settings. You can disable them if you’d like with the remove_post_type_support() method.

i18n (Internationalization)

We’ve heard many of our users across the world are interested in translating Edit Flow into their native languages. With this release, we’ve gone through and cleaned up the plugin to make that easy. If you’re interested in providing a translation for Edit Flow, please get in touch and we’ll gladly include it with the plugin. Pig latin is a language too!

Filtering Users and Usergroups

User and Usergroup search and filters

User and Usergroup search and filters

If you have a large list of users, you now how difficult it can be to scroll through and find the exact person you’re looking for. We’ve added filters and search-as-you-type to user and usergroup lists to make that a little easier.

Email Queueing

Emails sent by Edit Flow are now optimized to use queueing for improved performance (and to avoid being flagged as spam).

Bug Fixes

We’ve also fixed a number of bugs:

  • Users without JavaScript no longer see the status dropdown
  • Users with JavaScript no longer see the respond button for editorial comments
  • Contributors should not have the ability to publish through Quick Edit
  • Proper i18n support (Thanks Beto Frega and others)
  • Editorial Comments issue in IE (Thanks asecondwill and James Skaggs)
  • Always email admin feature was not working (Thanks nicomollet)
  • Notifications for scheduled posts did not include links (Thanks erikajurney)

For the full list of changes in this release, view the changelog. If you run into issues, the best place to go for help is the WordPress.org Support Forum.

How to disable email notifications for post status changes

In the WordPress.org forum, a user wanted to know how to disable email notifications for post status changes without also disabling email notifications for new editorial comments. Edit Flow makes this pretty simple to do. Simply add the following snippet to the functions.php file of your active theme and you’re good to go!

As of v0.6, Edit Flow hooks into ‘transition_post_status’ to add an email notification when the post status changes. To disable these email notifications, all you need to do is remove the hook.

Looking for your input: our first Edit Flow survey

As we start putting the finishing touches on v0.6, we’ve realized that we want to hear more from our users. Please fill out the survey at the below link so we can better shape Edit Flow’s future toward your needs. Thanks in advance!

Take our survey here

v0.5.3: Duplication Bug Fix

We just pushed out v0.5.3 which fixes the duplication issue that users have been reporting. Thanks to everyone for letting us know about the issue.

You should be prompted for an upgrade from the WordPress admin, or you can download it here.

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.

Edit Flow v0.5: Introducing the editorial calendar

After a bit of a hiatus, meet Edit Flow v0.5. The editorial calendar has been on the feature request from the beginning. With this release Edit Flow takes another step toward full news-cycle management. I’m personally quite enthusiastic about this release, as it play a crucial role in my news organizations decision to use WordPress / Edit Flow as the print CMS for the daily newspaper that I manage. This release lays a foundation for several exciting enhancements to come.

Features introduced in this release:

EditFlow Calendar

  • Drag & Drop posts
  • 7 day calendar view

Filter by Custom Status

  • Writers: Show only posts assigned to me
  • Editors: Show only Draft status (great for managing deadlines)

If you haven’t upgraded yet, download it from the Plugin Directory or directly from within WordPress.