Home › Forums › Front End PM PRO › User's own avatar class › Reply To: User's own avatar class
November 5, 2017 at 4:12 am
#7766
Dominique Baril
Participant
All right, so I added this to my function.php and it works fine. Thanks Shamim
function fep_remove_own_avatar() {
$participants = fep_get_participants( get_the_ID() );
if (($key = array_search(get_current_user_id(), $participants)) !== false) {
unset($participants[$key]);
}
$current_user = get_current_user_id();
$count = 1;
?>
<div class="fep-avatar-p <?php echo ( count( $participants ) > 2 ) ? 'fep-avatar-p-120' : 'fep-avatar-p-90' ?>"><?php
foreach( $participants as $p ){
$participant_id = fep_get_userdata( $p, 'ID', 'ID' );
if( $count > 2 ){
echo '<div class="fep-avatar-more-60" title="' . __('More users', 'front-end-pm') . '"></div>';
break;
}
?><div class="fep-avatar-<?php echo $count; ?> <?php if ( $participant_id === $current_user) { echo "fep-avatar-own";} ?>"><?php echo get_avatar( $p, 60, '', '', array( 'extra_attr'=> 'title="'. fep_get_userdata( $p, 'display_name', 'ID' ) . '"') ); ?></div><?php
$count++;
}
echo '</div>';
}
add_action( 'fep_message_table_column_content_avatar', 'fep_remove_own_avatar' );