get_comment_author example



            $list_items_markup .= '<article>';
            $list_items_markup .= '<footer class="wp-block-latest-comments__comment-meta">';
            $author_url         = get_comment_author_url( $comment );
            if ( empty( $author_url ) && ! empty( $comment->user_id ) ) {
                $author_url = get_author_posts_url( $comment->user_id );
            }

            $author_markup = '';
            if ( $author_url ) {
                $author_markup .= '<a class="wp-block-latest-comments__comment-author" href="' . esc_url( $author_url ) . '">' . get_comment_author( $comment ) . '</a>';
            } else {
                $author_markup .= '<span class="wp-block-latest-comments__comment-author">' . get_comment_author( $comment ) . '</span>';
            }

            // `_draft_or_post_title` calls `esc_html()` so we don't need to wrap that call in             // `esc_html`.             $post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . wp_latest_comments_draft_or_post_title( $comment->comment_post_ID ) . '</a>';

            $list_items_markup .= sprintf(
                /* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */
                __( '%1$s on %2$s' ),
                


    $classes = array();
    if ( isset( $attributes['textAlign'] ) ) {
        $classes[] = 'has-text-align-' . $attributes['textAlign'];
    }
    if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
        $classes[] = 'has-link-color';
    }

    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
    $comment_author     = get_comment_author( $comment );
    $link               = get_comment_author_url( $comment );

    if ( ! empty( $link ) && ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
        $comment_author = sprintf( '<a rel="external nofollow ugc" href="%1s" target="%2s" >%3s</a>', esc_url( $link )esc_attr( $attributes['linkTarget'] )$comment_author );
    }
    if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
        $comment_author = wp_kses( $comment_author, array() );
    }

    return sprintf(
        '<div %1$s>%2$s</div>',
        
if ( current_user_can( 'edit_post', $post_id ) ) {
            $post_link  = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
            $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
        } else {
            $post_link = esc_html( get_the_title( $post_id ) );
        }
        echo $post_link;

        if ( $comment->comment_parent ) {
            $parent      = get_comment( $comment->comment_parent );
            $parent_link = esc_url( get_comment_link( $parent ) );
            $name        = get_comment_author( $parent );
            printf(
                /* translators: %s: Comment link. */
                ' | ' . __( 'In reply to %s.' ),
                '<a href="' . $parent_link . '">' . $name . '</a>'
            );
        }
        ?> </td> </tr> <tr> <th scope="row"><?php _e( 'Submitted on' ); ?></th> <td>

function comment_author( $comment_id = 0 ) {
    $comment = get_comment( $comment_id );

    $comment_author = get_comment_author( $comment );

    /** * Filters the comment author's name for display. * * @since 1.2.0 * @since 4.1.0 The `$comment_id` parameter was added. * * @param string $comment_author The comment author's username. * @param string $comment_id The comment ID as a numeric string. */
    echo apply_filters( 'comment_author', $comment_author$comment->comment_ID );
}
__( 'In response to: %s' ),
        '<b>' . $post_link . '</b>'
    );
    ?> </div> <?php if ( $comment->comment_parent ) :
    $parent = get_comment( $comment->comment_parent );
    if ( $parent ) :
        $parent_link = esc_url( get_comment_link( $parent ) );
        $name        = get_comment_author( $parent );
        ?> <div class="misc-pub-section misc-pub-reply-to"> <?php         printf(
            /* translators: %s: Comment link. */
            __( 'In reply to: %s' ),
            '<b><a href="' . $parent_link . '">' . $name . '</a></b>'
        );
        ?> </div> <?php
<?php endif; ?> <div class="comment-author vcard"> <?php             if ( 0 != $args['avatar_size'] ) {
                echo get_avatar( $comment$args['avatar_size'] );
            }
            ?> <?php             $comment_author = get_comment_author_link( $comment );

            if ( '0' == $comment->comment_approved && ! $show_pending_links ) {
                $comment_author = get_comment_author( $comment );
            }

            printf(
                /* translators: %s: Comment author link. */
                __( '%s <span class="says">says:</span>' ),
                sprintf( '<cite class="fn">%s</cite>', $comment_author )
            );
            ?> </div> <?php if ( '0' == $comment->comment_approved ) : ?> <em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em> <br />

function get_comment_author_rss() {
    /** * Filters the current comment author for use in a feed. * * @since 1.5.0 * * @see get_comment_author() * * @param string $comment_author The current comment author. */
    return apply_filters( 'comment_author_rss', get_comment_author() );
}

/** * Displays the current comment author in the feed. * * @since 1.0.0 */
function comment_author_rss() {
    echo get_comment_author_rss();
}


    public function column_comment( $comment ) {
        echo '<div class="comment-author">';
            $this->column_author( $comment );
        echo '</div>';

        if ( $comment->comment_parent ) {
            $parent = get_comment( $comment->comment_parent );

            if ( $parent ) {
                $parent_link = esc_url( get_comment_link( $parent ) );
                $name        = get_comment_author( $parent );
                printf(
                    /* translators: %s: Comment link. */
                    __( 'In reply to %s.' ),
                    '<a href="' . $parent_link . '">' . $name . '</a>'
                );
            }
        }

        comment_text( $comment );

        if ( $this->user_can ) {
            
Home | Imprint | This part of the site doesn't use cookies.