WordPress.org

Make WordPress Core

Ticket #34690: 34690.patch

File 34690.patch, 1.9 KB (added by subharanjan, 5 years ago)

Display register link when enabled

  • src/wp-includes/comment-template.php

     
    21982198         * @param array $fields The default comment fields.
    21992199         */
    22002200        $fields = apply_filters( 'comment_form_default_fields', $fields );
     2201
     2202        if ( get_option( 'users_can_register' ) ) {
     2203                $must_log_in = '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment or <a href="%s">register</a> here.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ), wp_registration_url() ) . '</p>';
     2204        } else {
     2205                $must_log_in = '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>';
     2206        }
     2207
    22012208        $defaults = array(
    22022209                'fields'               => $fields,
    22032210                'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>',
    22042211                /** This filter is documented in wp-includes/link-template.php */
    2205                 'must_log_in'          => '<p class="must-log-in">' . sprintf(
    2206                                               /* translators: %s: login URL */
    2207                                               __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
    2208                                               wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) )
    2209                                           ) . '</p>',
     2212                'must_log_in'          => $must_log_in,
    22102213                /** This filter is documented in wp-includes/link-template.php */
    22112214                'logged_in_as'         => '<p class="logged-in-as">' . sprintf(
    22122215                                              /* translators: 1: edit user link, 2: accessibility text, 3: user name, 4: logout URL */