If the recipients users don’t set custom avatar and the current_user send multiple messages with the same subject, it become very difficult to retrieve a specific conversation without the search bar, because all messages will be displayed with the exact same information. Since I don’t allow multiple recipients on my setup, it was not only confusing but irrelevant to display current username in the author column.
So I added the following code in function.php that force to always display recipient username instead of last message author name in messagebox.
This is only meant to be use with a max recipients of 1
Admin > Front End PM > Settings > Recipient > Max recipients : 1
function fep_force_recipient_username() {
$participants = fep_get_participants( get_the_ID() );
if (($key = array_search(get_current_user_id(), $participants)) !== false) {
unset($participants[$key]);
}
foreach( $participants as $p ){
$participant_name = fep_get_userdata( $p, 'display_name', 'ID' );
}
?><span class="fep-message-author"><?php echo "$participant_name"; ?></span><span class="fep-message-date"><?php the_time(); ?></span><?php
}
add_action( 'fep_message_table_column_content_author', 'fep_force_recipient_username' );