Display Name

This topic contains 4 replies, has 3 voices, and was last updated by  cgsoi2 5 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #4510
    #4512

    Alex Rollin
    Moderator
    Post count: 27815

    I will flag your question for the developers.

    However, the integration you are talking about is part of Supreme, and uses a GD Post Meta to call up the username.

    Here in the UsersWP forum I will flag your topic for the developers to let us know if they have plans to allow display of names in a fallback manner, like, Fullname if set, or username if not.

    #4515

    cgsoi2
    Free User
    Post count: 3

    Great, much thanks.

    #4516

    Patrik
    Moderator
    Post count: 1971

    Hi,

    This is related to supreme directory theme. There are many filters you can use to customize it as required. Currently the theme has a filter for author link but it doesn’t have user ID passed into it so you can not use that but you can try following code which uses the default WP filter for a username changed to display name:

    add_filter('get_the_author_user_nicename', 'get_the_author_user_nicename_cb', 10, 2);
    function get_the_author_user_nicename_cb($value, $user_id){
        if(geodir_is_page('single')){
            $user_info = get_userdata($user_id);
            if(isset($user_info->display_name)){
                return $user_info->display_name;
            } else{
                return $user_info->first_name. ' ' . $user_info->last_name;
            }
        }
    
        return $value;
    
    }

    Let me know if this helps you or not. We will also put the user id in the theme’s filter so one can use it.

    Regards,
    Patrik

    #4533

    cgsoi2
    Free User
    Post count: 3

    Hi Patrik, very much appreciated, worked perfectly!

    Best regards.

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket