Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Comments, trackbacks & pings (http://forum.bytesforall.com/forumdisplay.php?f=19)
-   -   Display full name in comments instead of user name (http://forum.bytesforall.com/showthread.php?t=1735)

tationline May 21, 2009 03:32 AM

Display full name in comments instead of user name
 
Hello,

I am using Atahualpa 3.3.2. Is it possible to change the way the author name in comments in displayed?
Currently it shows e.g. "user1" (login name)
I would like to see the full name of the user who wrote the comment, e.g. "User One" (firstname lastname).

I saw that there are several author name options in the "Post/Page Info Items", but I couldn't find the right spot where to change it for comments. :confused:

Thanks in advance for help :)

Flynn May 21, 2009 07:10 PM

Post/info items is not for comments, only for posts and pages.

You mean the displayed name for logged in users? (Since all others choose their author name anyway, by putting it into the "name" field in the comment form).

Replace in functions/bfa_custom_comments.php

PHP Code:

<?php comment_author_link(); ?>

with
PHP Code:

<?php if ($comment->user_id) {
$user=get_userdata($comment->user_id);
echo 
$user->user_nicename;
} else { 
comment_author_link(); } ?>


tationline May 22, 2009 04:08 AM

Thanks for your quick response.
Yes I mean the display name in comments for registered users.

I just tried to make the changes, but I do not have the file functions/bfa_custom_comments.php
This is also not available in the original zip-file (atahualpa332.zip).

Should I create this file?

Flynn May 22, 2009 08:40 AM

Sorry, bfa_custom_comments.php was introduced in 3.3.3

In 3.3.2 replace in functions/bfa_comment_walker.php

PHP Code:

<?php printf(__('%s'), get_comment_author_link()) ?>

with

PHP Code:

<?php if ($comment->user_id) {
$user=get_userdata($comment->user_id);
echo 
$user->user_nicename;
} else { 
comment_author_link(); } ?>


tationline May 26, 2009 06:40 AM

Hi Flynn,

I modified the file as you suggested, but within the comments section there is still the username visible and not the full name. I tested it with existing comments and new comments (created after the change).

Is there anything else that needs to be done?

juggledad May 27, 2009 06:58 AM

change 'user_nicename' to 'display_name' and then make sure to pick the format you want in the dashboard -> Users -> Your Profile -> Display name publicly as:

Flynn,
looks like nicename isn't the right row to use. It would be nice to grab and concatenate 'first_name' and 'last_name' from wp-usermeta.


All times are GMT -6. The time now is 07:57 AM.

Powered by vBulletin® Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.