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)
-   -   Modying comment author display (http://forum.bytesforall.com/showthread.php?t=6703)

markelshark Apr 13, 2010 09:44 AM

Modying comment author display
 
Out of the box when a *logged-in* user types a comment on a Atahualpa blog it displays their nickname (which might be the same thing as their first name? not sure) next to their comment.

So for me, for example, my nickname is "Mark" and my username is "piphut". When I post a comment it takes the form of:

Mark: this is my comment.


What I would like to do is add the username next to the nickname, in parenthesis, next to an '@' symbol. The username would not link to anything, just be text. So the above comment would now look like:

Mark (@piphut): this is my comment.

Any suggestions?


P.S. for anyone interested this is because I recently integrated Buddypress with atahualpa and using the @username function works just like a twitter mention. @nickname does nothing.

markelshark Apr 20, 2010 02:20 PM

bump. Any ideas for this?

juggledad Apr 20, 2010 05:53 PM

This is not something that is done in the theme, it's done in the wordpress code. the actual call to teh wordpress code is in bfa_custom_comment.php line 16 (in version 3.4.6) There you will see a comment_author_link() and that is the routing that gets the comments (it is in wp-includes/comment-template.php)

What is worse is that the value that is dislayed depends on the setting of the 'Display name publicly as' option of teh USER profile AT THE TIME THE COMMENT IS MADE. i.e. if the user name was 'admin' and the 'Display name publicly as' is 'admin' when you make a comment, the comment shows as being made by 'admin'. If you now go in to the admin user and add a nickname of 'The Man' and change teh 'Display name publicly as' to 'The Man' and make a comment, it will display as 'The Man' while the previous comment will show 'admin'

so....no there is no easy way to do what you want to do, the name associated with the comment is actually stored in the comment at the time it is made. - you can actually delete a user from te database and their name will still be associated with comments they have made.

dodge Apr 24, 2010 03:02 PM

Hi,

This is possible by hacking two lines in wp-comment-post.php.

check from line 50...

Quote:

if ( $user->ID ) {

//if ( empty( $user->display_name ) ) // comment this line out
// $user->display_name=$user->user_login; // comment this line out
$user->display_name = $user->display_name."(@".$user->user_login.")"; // add this to the line that sets the comment name
$comment_author = $wpdb->escape($user->display_name);
$comment_author_email = $wpdb->escape($user->user_email);
$comment_author_url = $wpdb->escape($user->user_url);


All times are GMT -6. The time now is 09:19 AM.

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