Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_comment_author [ WordPress Function ]

get_comment_author ( $comment_ID = 0 )
Parameters:
  • (int) $comment_ID The ID of the comment for which to retrieve the author. Optional.
Uses:
Returns:
  • (string) The comment author
Defined at:



Retrieve the author of the current comment.

If the comment has an empty comment_author field, then 'Anonymous' person is assumed.

Source


<?php
function get_comment_author$comment_ID ) {
    
$comment get_comment$comment_ID );
    if ( empty(
$comment->comment_author) ) {
        if (!empty(
$comment->user_id)){
            
$user=get_userdata($comment->user_id);
            
$author=$user->user_login;
        } else {
            
$author __('Anonymous');
        }
    } else {
        
$author $comment->comment_author;
    }
    return 
apply_filters('get_comment_author'$author);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics