WordPress.org

Make WordPress Core

Changeset 24053


Ignore:
Timestamp:
04/22/2013 08:21:22 PM (7 years ago)
Author:
nacin
Message:

Add wp_registration_url() and register_url filter.

props scribu, JustinSainton, SergeyBiryukov.
fixes #17950.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r23916 r24053  
    220220 * Returns the Log Out URL.
    221221 *
    222  * Returns the URL that allows the user to log out of the site
     222 * Returns the URL that allows the user to log out of the site.
    223223 *
    224224 * @since 2.7.0
    225  * @uses wp_nonce_url() To protect against CSRF
    226  * @uses site_url() To generate the log in URL
    227  * @uses apply_filters() calls 'logout_url' hook on final logout url
     225 * @uses wp_nonce_url() To protect against CSRF.
     226 * @uses site_url() To generate the log out URL.
     227 * @uses apply_filters() calls 'logout_url' hook on final logout URL.
    228228 *
    229229 * @param string $redirect Path to redirect to on logout.
     
    245245 * Returns the Log In URL.
    246246 *
    247  * Returns the URL that allows the user to log in to the site
     247 * Returns the URL that allows the user to log in to the site.
    248248 *
    249249 * @since 2.7.0
    250  * @uses site_url() To generate the log in URL
    251  * @uses apply_filters() calls 'login_url' hook on final login url
     250 * @uses site_url() To generate the log in URL.
     251 * @uses apply_filters() calls 'login_url' hook on final login URL.
    252252 *
    253253 * @param string $redirect Path to redirect to on login.
     
    265265
    266266    return apply_filters('login_url', $login_url, $redirect);
     267}
     268
     269/**
     270 * Returns the user registration URL.
     271 *
     272 * Returns the URL that allows the user to register on the site.
     273 *
     274 * @since 3.6.0
     275 * @uses site_url() To generate the registration URL.
     276 * @uses apply_filters() calls 'register_url' hook on final URL.
     277 *
     278 * @return string
     279 */
     280function wp_registration_url() {
     281    return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
    267282}
    268283
     
    360375    if ( ! is_user_logged_in() ) {
    361376        if ( get_option('users_can_register') )
    362             $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
     377            $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
    363378        else
    364379            $link = '';
  • trunk/wp-login.php

    r23805 r24053  
    467467<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
    468468<?php if ( get_option( 'users_can_register' ) ) : ?>
    469  | <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( site_url( 'wp-login.php?action=register', 'login' ) ), __( 'Register' ) ) ); ?>
     469 | <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?>
    470470<?php endif; ?>
    471471</p>
     
    526526<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
    527527<?php if ( get_option( 'users_can_register' ) ) : ?>
    528  | <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( site_url( 'wp-login.php?action=register', 'login' ) ), __( 'Register' ) ) ); ?>
     528 | <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?>
    529529<?php endif; ?>
    530530</p>
     
    733733<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : ?>
    734734    <?php if ( get_option( 'users_can_register' ) ) : ?>
    735         <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( site_url( 'wp-login.php?action=register', 'login' ) ), __( 'Register' ) ) ); ?> |
     735        <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?> |
    736736    <?php endif; ?>
    737737    <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.