Pass the original `$user_id` variable to the filter in `get_the_author_meta()`.

Props dlh, chriscct7.
Fixes #32481.
Built from https://develop.svn.wordpress.org/trunk@32594


git-svn-id: http://core.svn.wordpress.org/trunk@32564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-05-25 13:06:25 +00:00
parent 677c3e53bb
commit 51a892f975
2 changed files with 8 additions and 4 deletions

View File

@ -111,6 +111,8 @@ function the_modified_author() {
* @return string The author's field from the current author's DB object. * @return string The author's field from the current author's DB object.
*/ */
function get_the_author_meta( $field = '', $user_id = false ) { function get_the_author_meta( $field = '', $user_id = false ) {
$original_user_id = $user_id;
if ( ! $user_id ) { if ( ! $user_id ) {
global $authordata; global $authordata;
$user_id = isset( $authordata->ID ) ? $authordata->ID : 0; $user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
@ -129,11 +131,13 @@ function get_the_author_meta( $field = '', $user_id = false ) {
* The filter name is dynamic and depends on the $field parameter of the function. * The filter name is dynamic and depends on the $field parameter of the function.
* *
* @since 2.8.0 * @since 2.8.0
* @since 4.3.0 The `$original_user_id` parameter was added.
* *
* @param string $value The value of the metadata. * @param string $value The value of the metadata.
* @param int $user_id The user ID. * @param int $user_id The user ID for the value.
* @param int|bool $original_user_id The original user ID, as passed to the function.
*/ */
return apply_filters( 'get_the_author_' . $field, $value, $user_id ); return apply_filters( 'get_the_author_' . $field, $value, $user_id, $original_user_id );
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32593'; $wp_version = '4.3-alpha-32594';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.