Make WordPress Core

Changeset 29774


Ignore:
Timestamp:
09/28/2014 06:37:10 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Don't display an empty comment author IP link on Comments screen.

props afercia.
fixes #29766.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r29707 r29774  
    526526                echo '<br />';
    527527            }
    528             echo '<a href="edit-comments.php?s=';
    529             comment_author_IP();
    530             echo '&amp;mode=detail';
    531             if ( 'spam' == $comment_status )
    532                 echo '&amp;comment_status=spam';
    533             echo '">';
    534             comment_author_IP();
    535             echo '</a>';
     528
     529            $author_ip = get_comment_author_IP();
     530            if ( $author_ip ) {
     531                $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' );
     532                if ( 'spam' == $comment_status ) {
     533                    $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );
     534                }
     535                printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip );
     536            }
    536537        }
    537538    }
Note: See TracChangeset for help on using the changeset viewer.