Make WordPress Core

Ticket #23087: patch.diff

File patch.diff, 5.0 KB (added by colinhahn, 8 years ago)

Uses wp_registration_url to filter all register links

  • wp-activate.php

    diff --git a/wp-activate.php b/wp-activate.php
    index a796cc5..ee6d818 100644
    a b require( dirname(__FILE__) . '/wp-load.php' ); 
    1414require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    1515
    1616if ( !is_multisite() ) {
    17         wp_redirect( site_url( '/wp-login.php?action=register' ) );
     17        wp_redirect( wp_registration_url() );
    1818        die();
    1919}
    2020
  • wp-includes/canonical.php

    diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php
    index f75a72e..7bb0915 100644
    a b function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    326326                                /** This filter is documented in wp-login.php */
    327327                                $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
    328328                        } else {
    329                                 $redirect_url = site_url( 'wp-login.php?action=register' );
     329                                $redirect_url = wp_registration_url();
    330330                        }
    331331
    332332                        wp_redirect( $redirect_url, 301 );
  • wp-includes/general-template.php

    diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
    index 8f2cdf6..0bfa2e1 100644
    a b function wp_login_url($redirect = '', $force_reauth = false) { 
    357357 * Returns the URL that allows the user to register on the site.
    358358 *
    359359 * @since 3.6.0
     360 * @since 4.4.0 The `$scheme` parameter was added.
    360361 *
    361362 * @return string User registration URL.
    362363 */
    363 function wp_registration_url() {
     364function wp_registration_url( $scheme = null ) {
    364365        /**
    365366         * Filter the user registration URL.
    366367         *
    function wp_registration_url() { 
    368369         *
    369370         * @param string $register The user registration URL.
    370371         */
    371         return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
     372        return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', $scheme ) );
    372373}
    373374
    374375/**
    function wp_lostpassword_url( $redirect = '' ) { 
    515516function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
    516517        if ( ! is_user_logged_in() ) {
    517518                if ( get_option('users_can_register') )
    518                         $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
     519                        $link = $before . '<a href="' . esc_url( wp_registration_url( 'login' ) ) . '">' . __('Register') . '</a>' . $after;
    519520                else
    520521                        $link = '';
    521522        } else {
  • wp-login.php

    diff --git a/wp-login.php b/wp-login.php
    index 57b2a2e..791d195 100644
    a b case 'retrievepassword' : 
    578578<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
    579579<?php
    580580if ( get_option( 'users_can_register' ) ) :
    581         $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
     581        $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url( 'login' ) ), __( 'Register' ) );
    582582
    583583        /** This filter is documented in wp-includes/general-template.php */
    584584        echo ' | ' . apply_filters( 'register', $registration_url );
    case 'rp' : 
    687687<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
    688688<?php
    689689if ( get_option( 'users_can_register' ) ) :
    690         $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
     690        $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url( 'login' ) ), __( 'Register' ) );
    691691
    692692        /** This filter is documented in wp-includes/general-template.php */
    693693        echo ' | ' . apply_filters( 'register', $registration_url );
    case 'register' : 
    742742        login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
    743743?>
    744744
    745 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">
     745<form name="registerform" id="registerform" action="<?php echo esc_url( wp_registration_url( 'login_post' ) ); ?>" method="post" novalidate="novalidate">
    746746        <p>
    747747                <label for="user_login"><?php _e('Username') ?><br />
    748748                <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
    default: 
    944944<p id="nav">
    945945<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) :
    946946        if ( get_option( 'users_can_register' ) ) :
    947                 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
     947                $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url( 'login' ) ), __( 'Register' ) );
    948948
    949949                /** This filter is documented in wp-includes/general-template.php */
    950950                echo apply_filters( 'register', $registration_url ) . ' | ';
  • wp-signup.php

    diff --git a/wp-signup.php b/wp-signup.php
    index 3373f8e..34e835b 100644
    a b function do_signup_header() { 
    2828add_action( 'wp_head', 'do_signup_header' );
    2929
    3030if ( !is_multisite() ) {
    31         wp_redirect( site_url('wp-login.php?action=register') );
     31        wp_redirect( wp_registration_url() );
    3232        die();
    3333}
    3434