WordPress.org

Make WordPress Core

Ticket #4478: wp-login.php.diff

File wp-login.php.diff, 4.1 KB (added by stealthdave, 11 years ago)

Patch to allow custom login / registration templates from template. Updated patch works with 2.5.1.

  • wp-login.php

    old new  
    11<?php
    22require( dirname(__FILE__) . '/wp-config.php' );
    33
     4/* support for custom error page by user kevinobvious -- http://wordpress.org/support/topic/109477 */
     5if (function_exists('get_template_directory')){
     6        $templatedir = get_template_directory();
     7        if ( file_exists($templatedir.'/login.php') ){
     8                include($templatedir.'/login.php');
     9        }
     10}
    411// Rather than duplicating this HTML all over the place, we'll stick it in function
    5 function login_header($title = 'Login', $message = '', $wp_error = '') {
     12function login_header_error($message = '', $wp_error = '') {
    613        global $error;
    714
    815        if ( empty($wp_error) )
    916                $wp_error = new WP_Error();
    10         ?>
    11 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    12 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    13 <head>
    14         <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
    15         <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    16         <?php
    17         wp_admin_css( 'css/login' );
    18         wp_admin_css( 'css/colors-fresh' );
    19         ?>
    20         <script type="text/javascript">
    21                 function focusit() {
    22                         document.getElementById('user_login').focus();
    23                 }
    24                 window.onload = focusit;
    25         </script>
    26 <?php do_action('login_head'); ?>
    27 </head>
    28 <body class="login">
    2917
    30 <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
    31 <?php
    3218        if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
    3319
    3420        // Incase a plugin uses $error rather than the $errors object
     
    5440                if ( !empty($messages) )
    5541                        echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
    5642        }
     43}
     44
     45if (!function_exists('login_header')) {
     46function login_header($title = 'Login', $message = '', $wp_error = '') {
     47
     48        ?>
     49<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     50<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
     51<head>
     52        <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
     53        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
     54        <?php
     55        wp_admin_css( 'css/login' );
     56        wp_admin_css( 'css/colors-fresh' );
     57        ?>
     58        <script type="text/javascript">
     59                function focusit() {
     60                        document.getElementById('user_login').focus();
     61                }
     62                window.onload = focusit;
     63        </script>
     64<?php do_action('login_head'); ?>
     65</head>
     66<body class="login">
     67
     68<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
     69<?php
     70        login_header_error($message, $wp_error);
    5771} // End of login_header()
     72}
     73if (!function_exists('login_footer')) {
     74        function login_footer() {
     75                echo "\n</body>\n</html>";
     76        }
     77} // End of login_footer()
    5878
    5979function retrieve_password() {
    6080        global $wpdb;
     
    269289
    270290<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
    271291
    272 </body>
    273 </html>
    274292<?php
     293login_footer();
    275294break;
    276295
    277296case 'resetpass' :
     
    333352</div>
    334353
    335354<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
    336 
    337 </body>
    338 </html>
    339355<?php
     356login_footer();
    340357break;
    341358
    342359case 'login' :
     
    410427</div>
    411428
    412429<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
    413 
    414 </body>
    415 </html>
    416430<?php
    417 
     431login_footer();
    418432break;
    419433} // end action switch
    420434?>