Track which user actually published a post, separate from who created the post. Display that info as a column in admin post listings.
This plugin records which user actually published a post, which in a multi-author environment may not always be the original post author. This helps to maintain accountability for who was ultimately responsible for a post appearing live on a site.
The admin listing of posts is amended with a new “Published By” column that shows the name of the person who published the post (for those posts that have actually been published). A dropdown above admin post listings allows for the listing to be filtered by a particular publishing user (but only includes posts with a known publishing user).
For posts that were published prior to the use of this plugin (and thus the plugin could not directly record who published those posts), the plugin makes a best guess attempt to ascertain who published the post. After failing to find the publisher of the post as recorded by the plugin, it checks for who last edited the post, then who is responsible for the latest revision of the post, and finally failing those, it assumes it was the post author. In cases where it had to go through this process, the name of the person it deduced as the likely publisher appears italicized and with a question mark at the end. If you’d rather the plugin not make an attempt to guess the publisher, you can disable the checks by including this snippet in your theme’s functions.php (or, ideally, a site-specific mu-plugin):
<?php add_filter( 'c2c_published_by_skip_guessing', '__return_true' ); ?>
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
published-by.zip
inside the plugins directory for your site (typically wp-content/plugins/
)A screenshot of the admin post listing showing the added "Published By" column. It demonstrates the mix of a post puublished by the current user, a post poblished by another user and two posts that existed before the plugin was activated (one guessed to be published by the current user and one guessed to be published by yet another user).
A screenshot of the Publish metabox for a published post showing the current user who published the post.
A screenshot of the Publish metabox for a published post showing another user who published the post.
published-by.zip
inside the plugins directory for your site (typically wp-content/plugins/
)The user most recently responsible for a post getting published will be recorded as the publishing user. Editing a published post does not change the publishing user.
In the upper-right of the page is a “Screen Options” link that reveals a panel of options. In the “Columns” section, check (to show) or uncheck (to hide) the “Published By” option.
It’s an indication that for the given post the name shown is a guess by the plugin based on existing post data. For posts that were published prior to the use of this plugin (and thus the plugin could not directly record who published those posts), the plugin makes a best guess attempt to ascertain who published the post. After failing to find the publisher of the post as recorded by the plugin, it checks for who last edited the post, then who is responsible for the latest revision of the post, and finally failing those, it assumes it was the post author. It’s likely that the guess is correct, but it’s impossible to say for certain when the plugin isn’t activated when posts were published.
Yes.
get_user_url()
to get the link to the user’s profileis_publisher_id_guessed()
to determine if the publisher_id for a given post was guessedregister_meta()
register_meta()
hide_meta()
in favor of use of register_meta()
get_post_statuses()
as getter for post statuses that should have the ‘Published By’ columnget_post_statuses()
rather than just once on ‘init’get_publisher_id()
returns an integer value.WP_TESTS_DIR
to /tmp/wordpress-tests-lib
rather than erroring out if not defined via environment variable.dirname(__FILE__)
instead of __DIR__
since the latter is only available on PHP 5.3+.dirname(__FILE__)