Forum Discussion

cgmcconnell's avatar
14 years ago

Display user's real name instead of user handle?

I'm wondering if there is a way to change the display name of a user from their user login/handle to their real name?  For example, on Lithium Blogs there is an option to use the posters real name, the post then appears to be from:

 

Colin McConnell (cgmcconnell)

 

Is it possible to add this logic to all posts in the community?  Or even take it a step further and only show:

 

Colin McConnell

 

Any insight or assistance is appreciated.


Thanks,
Colin

  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)

    There isn't a config option to do this for message posts but you could customize your message page to show first name and last name.

     

    You would need to create a custom component that pulled the user's first/last name from their profile setting then add it to the Forum Message page.  Before you do that - I can help you through the technical steps if you need it - you should think about a couple of things.

     

    1. Do your users have first name and last name filled out? A lot users do not enter personally identifiable information in their community accounts.

     

    2.  How will your users feel if you start displaying their name?  Do you want to add an option for turning this off or having users opt in before this is displayed?

     

    There is a lot of back and forth on "real names" in comments and posts.  Make sure you know what you are getting into :)

    • cgmcconnell's avatar
      cgmcconnell
      Expert

      Hey Kaela,

       

      Thanks for such a quick response!  In regards to your questions, thanks for bringing up those points, as they relate to my community:

       

      1.  Foruntately we have the first and last name for all of our users as we use SSO tied to our existing registration process (which requires a name and is usually accurate).  Additionally, half of our user base are our interntal customers which have 100% accurate information.

       

      2.  That's an interesting thought but I feel pretty comfortable switching it on as, by default, we show first and last name on their user profile page.

       

      Also, I'm assuming the custom component could be placed everywhere a username is used?

       

      Thanks,
      Colin

      • KaelaC's avatar
        KaelaC
        Lithium Alumni (Retired)

        Hi Colin,

         

        Sorry for the late reply.  There are two parts to this that you will need to do.  The first is create a custom component that pulls the user's first and last name.  Like Adam said, you can use env.context.message.author to figure out who the message author is.

         

        <#assign allowed=rest("/users/id/${env.context.message.author?c}/profiles/name/name_first/allowed").value />
        
        <#if allowed?trim == "true">
        	<#assign first_name= rest("/users/id/${env.context.message.author?c?c}/profiles/name/name_first").value!"" />
        
        	<#assign last_name= rest("/users/id/${env.context.message.author?c?c}/profiles/name/name_last").value!"" />
        </#if>
        
        ${first_name} ${last_name}

         

        The first part of this look to see if the current user has permission to see the author's profile information. Next, it amakes rest calls to get that information.  Lastly, it displays the first and last names.  

         

        The second part is to add this new component to the ForumMessage page in studio.  I'm having a hard time finding it myself so you may need to ask support to do that (or maybe I'm just going blind).