Always display recipient username instead of last message author name in message


Home Forums Front End PM PRO Always display recipient username instead of last message author name in message

This topic is: Not Resolved
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #7776
    Dominique Baril
    Participant

    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' );
Viewing 1 post (of 1 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.