From b35b81f298fda504a04763b05c7436a1cd83eab9 Mon Sep 17 00:00:00 2001 From: westi Date: Fri, 27 Feb 2009 17:54:47 +0000 Subject: [PATCH] Add (get_)the_modified_author template tags. Fixes #9154 props tomontoast. git-svn-id: http://svn.automattic.com/wordpress/trunk@10661 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/author-template.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 34b9efe08..7f079772f 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -50,6 +50,35 @@ function the_author($deprecated = '', $deprecated_echo = true) { return get_the_author(); } +/** + * Retrieve the author who last edited the current post. + * + * @since 2.8 + * @uses $post The current post's DB object. + * @uses get_post_meta() Retrieves the ID of the author who last edited the current post. + * @uses get_userdata() Retrieves the author's DB object. + * @uses apply_filters() Calls 'the_modified_author' hook on the author display name. + * @return string The author's display name. + */ +function get_the_modified_author() { + global $post; + if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) { + $last_user = get_userdata($last_id); + return apply_filters('the_modified_author', $last_user->display_name); + } +} + +/** + * Display the name of the author who last edited the current post. + * + * @since 2.8 + * @see get_the_author() + * @return string The author's display name, from get_the_modified_author(). + */ +function the_modified_author() { + echo get_the_modified_author(); +} + /** * Retrieve the description of the author of the current post. *