function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$GLOBALS['comment'] = clone $comment;

if ( $comment->comment_post_ID > 0 ) {
$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
$comment_post_url = get_the_permalink( $comment->comment_post_ID );
$comment_post_link = '' . $comment_post_title . '';
} else {
$comment_post_link = '';

$actions_string = '';
if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
// Pre-order it: Approve | Reply | Edit | Spam | Trash.
$actions = array(
'approve' => '',
'unapprove' => '',
'reply' => '',
'edit' => '',
'spam' => '',
'trash' => '',
'delete' => '',
'view' => '',
);

$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'approve-comment_' . $comment->comment_ID ) );
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) );

$action_string = 'comment.php?action=%s&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . '&%s';

$approve_url = sprintf( $action_string, 'approvecomment', $approve_nonce );
$unapprove_url = sprintf( $action_string, 'unapprovecomment', $approve_nonce );
$spam_url = sprintf( $action_string, 'spamcomment', $del_nonce );
$trash_url = sprintf( $action_string, 'trashcomment', $del_nonce );
$delete_url = sprintf( $action_string, 'deletecomment', $del_nonce );

$actions['approve'] = sprintf(
'%s',
esc_url( $approve_url ),
"dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved",
esc_attr__( 'Approve this comment' ),
__( 'Approve' )
);

$actions['unapprove'] = sprintf(
'%s',
esc_url( $unapprove_url ),
"dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved",
esc_attr__( 'Unapprove this comment' ),
__( 'Unapprove' )
);

$actions['edit'] = sprintf(
'%s',
"comment.php?action=editcomment&c={$comment->comment_ID}",
esc_attr__( 'Edit this comment' ),
__( 'Edit' )
);

$actions['reply'] = sprintf(
'',
$comment->comment_ID,
$comment->comment_post_ID,
esc_attr__( 'Reply to this comment' ),
__( 'Reply' )
);

$actions['spam'] = sprintf(
'%s',
esc_url( $spam_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::spam=1",
esc_attr__( 'Mark this comment as spam' ),
/* translators: "Mark as spam" link. */
_x( 'Spam', 'verb' )
);

if ( ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = sprintf(
'%s',
esc_url( $delete_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
esc_attr__( 'Delete this comment permanently' ),
__( 'Delete Permanently' )
);
} else {
$actions['trash'] = sprintf(
'%s',
esc_url( $trash_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
esc_attr__( 'Move this comment to the Trash' ),
_x( 'Trash', 'verb' )
);

$actions['view'] = sprintf(
'%s',
esc_url( get_comment_link( $comment ) ),
esc_attr__( 'View this comment' ),
__( 'View' )
);

/** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */
$actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );

$i = 0;

foreach ( $actions as $action => $link ) {
++$i;

if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i )
|| 1 === $i
) {
$separator = '';
} else {
$separator = ' | ';

// Reply and quickedit need a hide-if-no-js span.
if ( 'reply' === $action || 'quickedit' === $action ) {
$action .= ' hide-if-no-js';

if ( 'view' === $action && '1' !== $comment->comment_approved ) {
$action .= ' hidden';

$actions_string .= "{$separator}{$link}";
?>

  • >

    $comment_row_class = '';

    if ( get_option( 'show_avatars' ) ) {
    echo get_avatar( $comment, 50, 'mystery' );
    $comment_row_class .= ' has-avatar';
    ?>

    comment_type || 'comment' === $comment->comment_type ) : ?>



    // Comments might not have a post they relate to, e.g. programmatically created ones.
    if ( $comment_post_link ) {
    printf(
    /* translators: 1: Comment author, 2: Post link, 3: Notification if the comment is pending. */
    __( 'From %1$s on %2$s %3$s' ),
    '' . get_comment_author_link( $comment ) . '',
    $comment_post_link,
    '' . __( '[Pending]' ) . ''
    );
    } else {
    printf(
    /* translators: 1: Comment author, 2: Notification if the comment is pending. */
    __( 'From %1$s %2$s' ),
    '' . get_comment_author_link( $comment ) . '',
    '' . __( '[Pending]' ) . ''
    );
    ?>

    else :
    switch ( $comment->comment_type ) {
    case 'pingback':
    $type = __( 'Pingback' );
    break;
    case 'trackback':
    $type = __( 'Trackback' );
    break;
    default:
    $type = ucwords( $comment->comment_type );
    $type = esc_html( $type );
    ?>



    // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones.
    if ( $comment_post_link ) {
    printf(
    /* translators: 1: Type of comment, 2: Post link, 3: Notification if the comment is pending. */
    _x( '%1$s on %2$s %3$s', 'dashboard' ),
    "$type",
    $comment_post_link,
    '' . __( '[Pending]' ) . ''
    );
    } else {
    printf(
    /* translators: 1: Type of comment, 2: Notification if the comment is pending. */
    _x( '%1$s %2$s', 'dashboard' ),
    "$type",
    '' . __( '[Pending]' ) . ''
    );
    ?>









  • $GLOBALS['comment'] = null;
    View all references
    View on Trac
    View on GitHub