Ad Code Manager and Rewrite Rules Inspector

This is the week of releasing plugins!

Ad Code Manager is a plugin designed to help you deal with ad codes, those short snippets of Javascript used to display advertisements on your website. This week, Rinat Khaziev of Doejo, Jeremy Felt of 10up, and I pushed v0.2, which includes these improvements:

  • Completely reworked user interface, one that now looks and feels like much of the rest of the WordPress admin.
  • Abstracted ad network logic, so you can integrate additional ad networks. Currently, Ad Code Manager fully supports Double Click for Publishers. Pull requests with support for other ad networks are always welcome.
  • In-plugin contextual help to get you properly configured.
  • Priorities for ad codes, which allow you to work around conflicts.
  • An [acm-tag] shortcode for placing ad codes within posts.
  • A widget for placing ad codes in widget areas. Thanks to Justin Sternburg at WebDevStudios for the contribution.

Rewrite Rules Inspector is a simple development tool for viewing all of the rewrite rules registered with your site. It’s been available for VIPs hosted on WordPress.com for a while — today it’s available for download from the WordPress.org repository.

Specifically, the Rewrite Rules Inspector helps you:

  • View a listing of all your rewrite rules.
  • See which rewrite rules match a given URL (and the priorites they match in).
  • Filter by different sources of rewrite rules.
  • Know when rewrite rules are missing in the database by showing an error message.

Both plugins are available for forking in the Automattic Github repo, and pull requests are always welcome. Coming up next are improvements to Co-Authors Plus, P2 Resolved Posts, and a new round of development on Edit Flow…

Co-Authors Plus v2.6.3: Enhancements and bug fixes

Co-Authors Plus makes it easy to add multiple bylines to a given post, and has full support for custom post types. Out just a moment ago, v2.6.3 has the following improvements:

  • AJAX user search is back to searching against first name, last name, display name, email address and user ID. The method introduced in v2.6.2 didn’t scale well across hundreds of users.
  • French translation courtesy of Sylvain Bérubé.
  • Spanish translation courtesy of Alejandro Arcos.
  • Bug fix: Resolved incorrect caps check against user editing an already published post. Thanks to Doug in the WordPress.org forums for the help.

Please post any questions, bug reports, feature requests, etc. in the WordPress.org forums. If you want to contribute code, I’m eyeballing co-author management in Quick Edit and guest author functionality for v2.7.

For WordPress.com VIPs, this update has already been deployed to the shared plugins repo.

New plugin: P2 Resolved Posts

On Friday, I finally pushed P2 Resolved Posts live in the WordPress.org directory. Based on Nacin’s gist of the same name, it’s a “lightweight GTD plugin for WordPress and the P2 theme.”

Mark a thread as “unresolved” when the topic needs resolution, and mark it as “resolved” when you’ve achieved that state. There are also sidebar widgets to let you see all unresolved posts, optionally filtered to a specific tag.

We use P2 extensively at Automattic, for a variety of purposes. I improved Nacin’s code last November because I wanted a simple way to encourage the culture of coming to a resolution on a topic. All too often, conversations are left hanging. This is a problem for those participating, and an even larger problem for those reviewing the conversation at a later date.

The plugin is in-development on Github. Please post any feedback, issues, feature requests, etc. in the WordPress.org forums.

Co-Authors Plus v2.6.2: Enhancements and bug fixes

Co-Authors Plus makes it easy to add multiple bylines to a given post, and has full support for custom post types. Out just a moment ago, v2.6.2 has the following improvements:

  • AJAX user search matches against first name, last name, and nickname fields too, in addition to display name, user login, and email address.
  • Comment moderation and approved notifications are properly sent to all co-authors with the correct capabilities.
  • Filter required capability for user to be returned in an AJAX search with ‘coauthors_edit_author_cap’. This defaults to ‘edit_posts’
  • Filter out administrators and other non-authors from AJAX search with ‘coauthors_edit_ignored_authors’
  • Automatically adds co-authors to Edit Flow’s story budget and calendar views.
  • Bug fix: Don’t set post_author value to current user when quick editing a post. This doesn’t appear in the UI anywhere, but added the post to the current user’s list of posts. See related forum conversation.
  • Bug fix: Properly cc other co-authors on new comment email notifications
  • Bug fix: If a user has already been added as an author to a post, don’t show them in the AJAX search again.
  • Bug fix: Allow output constants to be defined in a theme’s functions.php file and include filters you can use instead.

Please post any questions, bug reports, feature requests, etc. in the WordPress.org forums. If you want to contribute code, I’m eyeballing co-author management in Quick Edit and guest author functionality for v2.7.

For WordPress.com VIPs, this update has already been deployed to the shared plugins repo.

Allowing authors to set co-authors

In the WordPress.org forums, whoaloic asks:

I have a site with multiple authors.
I would like to allow authors who create a post or a page to give rights to other authors.
For now, only administrator and editor can do that.
Is there a solution?

Yep, totally doable. By default, Co-Authors Plus defaults to ‘edit_others_posts’ as the required cap for changing co-authors. With the following code snippet in your theme’s functions.php file, you can make that cap ‘publish_posts’ instead (which authors and above usually have).

/**
 * Filter the Co-Authors Plus current_user_can_set_authors() function
 * so that users with 'publish_posts' can set Co-Authors
 *
 * @author danielbachhuber
 *
 * @see https://github.com/danielbachhuber/Co-Authors-Plus/issues/8
 * @see http://wordpress.org/support/topic/plugin-co-authors-plus-allow-authors-post-to-give-access-to-other-authors
 */
add_filter( 'coauthors_plus_edit_authors', 'db_filter_coauthors_edit_cap' );
function db_filter_coauthors_edit_cap( $cap_result ) {
	global $coauthors_plus;

	$post_type = $coauthors_plus->get_current_post_type();
	if( ! $post_type ) return false;
	
	$post_type_object = get_post_type_object( $post_type );
	return current_user_can( $post_type_object->cap->publish_posts );
}

In preparing this snippet, I also opened a couple of issues in Github:

New York Times releases code to help journalists collaborate on WordPress, other platforms

Aside

New York Times releases code to help journalists collaborate on WordPress, other platforms. Track changes within the WordPress editor. Code is available on Github; it would be awesome to see this support realtime collaborative editing too. (via Steve Myers)

Co-Authors Plus v2.6: Search user’s display names, change byline order and more

Co-Authors Plus makes it easy to add multiple bylines to a given post, and has full support for custom post types. Out this evening, v2.6 has the following improvements:

  • Sortable authors — drag and drop the order of the authors as you’d like them to appear
  • Search for authors by display name so you can easily add bylines by first or last name
  • Option to remove the first author when there are two or more listed
  • More reliably generates the published post count for each user

Thanks to those in the forum who provided feedback and special thanks to Russell Heimlich for his contributions with sortable authors. If you feel like giving back, there are a few tickets open we’d love patches for. In particular, guest bylines would be pretty neat. I have a possible direction you can go if you’re looking for inspiration.

For our WordPress.com VIPs, this release will be available in the shared plugins directory in just a moment.

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

Aside

Edit Flow v0.6.5: Fixes post timestamp issue when using custom statuses. Pretty annoying bug: 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.