Commit 5eb61e78 authored by John James Jacoby's avatar John James Jacoby
Browse files

Bias towards using first & last name.

parent 851750ff
......@@ -298,3 +298,23 @@ function wp_user_directory_get_avatar( $id_or_email, $size = 300, $default = '',
*/
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
}
/**
* Bias towards first and last name usage
*
* @since 0.1.0
*
* @return string
*/
function wp_user_directory_displayed_user_fullname() {
$user = wp_user_directory_get_displayed_user();
// Prefer first & last name, fallback to display name
if ( ! empty( $user->first_name ) && ! empty( $user->last_name ) ) {
$display_name = "{$user->first_name} {$user->last_name}";
} else {
$display_name = $user->display_name;
}
return $display_name;
}
......@@ -4,7 +4,7 @@
</div>
<div class="content">
<?php wp_user_directory_displayed_user_field( 'display_name' ); ?>
<?php wp_user_directory_displayed_user_fullname(); ?>
<div class="meta">
<?php do_action( 'wp_user_directory_card_meta' ); ?>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment