Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Display full name instead of username in comments?

edited August 2008 in Vanilla 1.0 Help
On the comments, I would like to display the users' full names instead of their usernames. I looked around, but I haven't been successful in locating where the relevant code is so that I can make the small modification. Can someone please help me find the code? As an extra bonus, it would be nice to know the variable or hash to replace in order to display the full name instead of the username. Thanks, Bryce

Comments

  • Options
    MarkMark Vanilla Staff
    That'll be do-able as an extension in 093.

    If you're still using 092, you'll need to alter the controls/comments.php file, line 132:

    $sReturn .= "<a href=\"account.php?u=".$Comment->AuthUserID."\">".$Comment->AuthUsername."</a></div>";

    Change to this:

    $sReturn .= "<a href=\"account.php?u=".$Comment->AuthUserID."\">".$Comment->AuthFullName."</a></div>";

    I believe that should do it. I just can't remember if first/last name are required fields in 092, I know they are *not* in 093, so I would do something like this to be safe:

    $sReturn .= "<a href=\"account.php?u=".$Comment->AuthUserID."\">".($Comment->AuthFullName == "" ? $Comment->AuthUsername : $Comment->AuthFullName )."</a></div>";
  • Options
    I am running 093, but I don't see that extension available. I don't mind editing the code myself, but I am having difficulty locating the relevant section. So how would I do these changes in 093? --bryce
  • Options
    Okay, I found the section of code, but $Comment->AuthFullName is not defined. I'm getting closer, though. themes/vanilla/templates/comments.php
  • Options
    MarkMark Vanilla Staff
    I didn't say it was an extension, I said you could do it as an extension. In other words, you could write an extension to do it.

    In 093 there is no AuthFullName on the user object. I got rid of it because it was slowing down the query and not being used on any of the pages (except the account profile).

    There is a lot to do to make it an extension in 093, and I don't have time to do it.

    Basically, you'd need to add the FirstName+LastName to the query that returns the comments by using a delegate. Then you'd need to do something wacky like (a) alter the user object so that if there is a fullname loaded in the object, display that as the username, or (b) make a new template for the comments or (c) alter the comment object so that if there is a fullname loaded, display that as the username, etc.

    There are many ways to accomplish it...
  • Options
    Well, the sooner there's an easy and forward-compatile way to do this, the better :)
  • Options
    Well, this is just what I would need - the problem doesn't seem to be solved. I changed the LDAP authentication in order to allow users from various Organizational Units do login, but my usernames are sort of coded - so it would be of a great help if I could change it to a FullName. Where is the query defined respectively the user object? Maybe there are many ways, but the path still isn't easy to find.
  • Options
    if someone could tell me where the query is executed that returns the comment infos, i would at least try to include the full name.
  • Options
    edited August 2008
    I'm in exactly the same situation. I use external authentication, and our usernames are company ID numbers. I don't want that displayed as the discussion and comment author; I'd like to see the user's real name there. I'll search to see if anyone has done an extension. Does anyone know if there is one already?
  • Options
    Really really need to know if this has moved further... like cjohnson above I use external authentication and my usernames are private... well they were until now... using 1.1.7 and can't find where to change everything.
    any hints
    # I have spent a bit of tme here... and sadly my php is nil so any help would not only be appreciated... but it is essential if I am to keep with Vanilla

    many thanks for looking
  • Options
    I really need this function as well for my new forum.
  • Options
    Given the dates of the original comments I am worried that this ain't gonna happen
  • Options
    Is there a place to ask this question more formally? I realise the developers are busy with 2.0 so know these are just one of many questions (and boy are we able to question!) however I would like to know where to ask.

    cheerts
  • Options
    Somebody must be able to help out here... using 1.1.7 and it must be simple for php gurus
  • Options
    Have you tried the FullName extension? I wrote that six months ago and submitted it to this site. It uses delegates where-ever it can to seamlessly integrate, but needs a little customisation in the theme.
  • Options
    I saw that but it was for Wordpress.. I use Elgg. though the principal is I expect the same... Elgg inserts the name into the FirstName Field. So would that work with this? would it replace the username with Firstname?

    I seriously hope so :)
    thanks so much for commentting
  • Options
    Call me an idiot... I found your addon.. and hey presto... you are now elevated to genius! thanks thanks thanks!
  • Options
    David - if you find anywhere that the extension does not display the full name, let me know and I'll get it added.
  • Options
    I think as an aside, Vanilla needs the ability built in from the start to hide the user names. User names are for logging in, and should *never* be exposed to anyone that does not need to know them.
  • Options
    Thanks judgej you are a star.. and I concur... usernames are just that... indeed half your private identity!

    In my All Discussions the username still appears.

    http://www.bajrfed.co.uk/mod/vanillaforum/vanilla/index.php

    everywhere else it is the Display Name
Sign In or Register to comment.