Show the words “You” rather than logged in user name


Home Forums Front End PM PRO Show the words “You” rather than logged in user name

This topic is: Not Resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #43364
    lia.spoerl
    Participant

    Hi,

    In user messages when I send message to other user, it shows to me my user name, which is fine. However what if you get two users with same display name?

    It would be nice to show the display name plus (you) in brackets by default

    Example: Lia (You) rather then just my name.

    Only the logged in user should see it (me in this case) and not receiving user.

    Is that possible?

    Thank-you

    #43386
    Shamim Hasan
    Keymaster

    You can add following code in your theme’s (child theme’s if you are using) functions.php

    add_filter( 'fep_filter_user_name', function( $name, $id ){
    	if ( $name && $id == get_current_user_id() ) {
    		$name .= " (You)";
    	}
    	return $name;
    }, 10, 2);
    
    #43485
    lia.spoerl
    Participant

    Hi,

    Sorry for late reply.

    This snippets works great.
    But there is one problem, it is messing up the email template tags.

    Example, when user gets email notification of new message the {{sender}} is showing “You” instead of the name of the user who sent the message..

    Could you provide a fix for this?

    Thanks for your help.

    #43503
    Shamim Hasan
    Keymaster

    You can try following code

    add_filter( 'fep_filter_user_name', function( $name, $id ){
    	if ( ! empty( $_GET['fepaction'] ) && $name && $id == get_current_user_id() ) {
    		$name .= " (You)";
    	}
    	return $name;
    }, 10, 2);
    

    Let me know.

Viewing 4 posts - 1 through 4 (of 4 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.