Plugin Directory

Changeset 721036


Ignore:
Timestamp:
05/31/2013 09:32:10 PM (13 years ago)
Author:
sideways8
Message:

Updating to version 0.8.5

Location:
s8-custom-login-and-registration
Files:
1 added
2 deleted
3 edited
15 copied

Legend:

Unmodified
Added
Removed
  • s8-custom-login-and-registration/tags/0.8.5/inc/forms.php

    r712965 r721036  
    44 */
    55
    6 if(!function_exists('s8_clr_get_form')):
     6if ( ! function_exists( 's8_clr_get_form' ) ):
    77    /**
    88     * Echos out the requested form
    99     * @since 0.8.1
    1010     */
    11     function s8_clr_get_form($form = 'login', $args = array(), $errors = false) {
     11    function s8_clr_get_form( $form = 'login', $args = array(), $errors = false ) {
    1212        global $s8_login_errors;
    13         if($errors === false)
     13        $args = array_merge( array(
     14            // Work on ANY form
     15            'split_lines' => false, // This splits the labels and form fields onto separate lines
     16            'single_line' => false, // This, when true, displays the entire form without any line breaks
     17            'use_html5_placeholders' => false, // When true, labels become HTML5 placeholder text instead
     18            'submit_text' => false, // This changes the submit button text, false uses the forms default value
     19
     20            // Works only on login form
     21            'hide_remember' => false, // Login form specific, hides the "Remember me" checkbox
     22        ), $args );
     23        if ( $errors === false ) {
    1424            $errors = $s8_login_errors;
    15         switch($form) {
    16             case 'register': // Register user
    17                 $redirect_url = ($_GET['redirect'] != '')?$_GET['redirect']:home_url();
    18                 ?><form method="post" action="<?php echo s8_get_register_url($redirect_url); ?>" name="register" class="s8_form register_form">
    19                     <?php
    20                     if(is_wp_error($errors)) {
    21                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    22                     }
    23                     elseif($errors !== false && !empty($errors) && !is_array($errors))
     25        }
     26        // Pick the right form
     27        switch ( $form ) {
     28            case 'register':
     29                /***** REGISTRATION FORM *****/
     30                $redirect_url = ( $_GET['redirect'] != '' ) ? $_GET['redirect'] : home_url();
     31                // Output our form
     32                ?><form method="post" action="<?php echo s8_get_register_url( $redirect_url ); ?>" name="register" class="s8_form register_form"><?php
     33                    // Output any errors we find
     34                    if ( is_wp_error( $errors ) ) {
     35                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     36                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
    2437                        echo '<p class="notice">'.$errors.'</p>';
    25                     ?>
    26                     <p>
    27                         <input type="hidden" name="s8-register-nonce" value="<?php echo wp_create_nonce('s8-register-new-user') ?>" />
    28                         <label for="username"><?php _e('Username'); ?></label>
    29                         <?php if($args['split_lines']) echo '<br/>'; ?>
    30                         <input type="text" name="username" id="username" value="<?php echo $_POST['username']; ?>" required="required" /><br/>
    31                         <label for="email"><?php _e('Email Address'); ?></label>
    32                         <?php if($args['split_lines']) echo '<br/>'; ?>
    33                         <input type="email" name="email" id="email" value="<?php echo $_POST['email']; ?>" required="required" /><br/>
    34                         A password will be e-mailed to you.<br/>
    35                         <input type="hidden" name="redirect" value="<?php echo $redirect_url?$redirect_url:''; ?>" />
    36                         <input type="submit" name="s8-register" value="Register" />
    37                         <?php if($args['login'])
    38                             echo '<br/>'.s8_get_login_link(false);
    39                         if($args['forgot'])
    40                             echo '<br/>'.s8_get_forgot_password_link(s8_get_current_url()); ?>
     38                    } ?>
     39                    <p>
     40                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-register-nonce' );
     41                        //<input type="hidden" name="s8-register-nonce" value="<?php echo wp_create_nonce('s8-register-new-user') ? >" />
     42
     43                        // USERNAME FIELD AND LABEL
     44                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     45                            ?><label for="username"><?php _e( 'Username' ); ?></label><?php
     46                        }
     47                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     48                        <input type="text" name="username" id="username" value="<?php echo $_POST['username']; ?>" required="required" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Username' ) . '"'; ?> /><?php
     49                        if ( ! $args['single_line'] ) echo '<br/>';
     50
     51                        // EMAIL ADDRESS FIELD AND LABEL
     52                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     53                            ?><label for="email"><?php _e( 'Email Address' ); ?></label><?php
     54                        }
     55                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     56                        <input type="email" name="email" id="email" value="<?php echo $_POST['email']; ?>" required="required" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Email Address' ) . '"'; ?> /><?php
     57                        if ( ! $args['single_line'] ) echo '<br/>';
     58
     59                        // PASSWORD NOTICE
     60                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>';
     61                        _e( 'A password will be e-mailed to you.' );
     62                        if ( ! $args['single_line'] ) echo '<br/>';
     63
     64                        // SUBMIT BUTTON AND LINKS ?>
     65                        <input type="hidden" name="redirect" value="<?php echo $redirect_url; ?>" />
     66                        <input type="submit" name="s8-register" value="<?php echo ( $args['submit_text'] ) ? $args['submit_text'] : __( 'Register' ); ?>" />
     67                        <?php
     68                        if ( $args['login'] ) {
     69                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_login_link( false );
     70                        }
     71                        if ( $args['forgot'] ) {
     72                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_forgot_password_link( s8_get_current_url() );
     73                        } ?>
    4174                    </p>
    4275                </form><?php
    4376                break;
    44             case 'reset': // Password reset
    45                 ?><form name="pass-reset" action="<?php echo home_url('/'.s8_login_registration::ep_login.'/?action=reset&key='.$_GET['key'].'&login='.$_GET['login']); ?>" method="post" class="s8_form reset_form">
    46                     <?php
    47                     if(is_wp_error($errors)) {
    48                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    49                     }
    50                     elseif($errors !== false && !empty($errors) && !is_array($errors))
    51                         echo '<p class="notice">'.$errors.'</p>';
    52                     ?>
    53                     <p>
    54                         <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-reset'); ?>" />
    55                         <label for="new-pass"><?php _e('New Password'); ?></label>
    56                         <?php if($args['split_lines']) echo '<br/>'; ?>
    57                         <input type="password" name="new-pass" id="new-pass" /><br/>
    58                         <label for="new-pass-confirm"><?php _e('Confirm New Password'); ?></label>
    59                         <?php if($args['split_lines']) echo '<br/>'; ?>
    60                         <input type="password" name="new-pass-confirm" id="new-pass-confirm" /><br/>
    61                         <input type="submit" name="s8-login-reset" value="Change Password" />
     77
     78            case 'reset':
     79                /***** PASSWORD RESET FORM *****/
     80                // Output our form
     81                ?><form name="pass-reset" action="<?php echo home_url( '/' . s8_login_registration::ep_login . '/?action=reset&key=' . $_GET['key'] . '&login=' . $_GET['login'] ); ?>" method="post" class="s8_form reset_form"><?php
     82                    // Output any errors we found
     83                    if ( is_wp_error( $errors ) ) {
     84                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     85                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
     86                        echo '<p class="notice">' . $errors . '</p>';
     87                    } ?>
     88                    <p>
     89                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-reset-nonce' );
     90                        // <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-reset'); ? >" />
     91
     92                        // NEW PASSWORD FIELD AND LABEL
     93                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     94                            ?><label for="new-pass"><?php _e( 'New Password' ); ?></label><?php
     95                        }
     96                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     97                        <input type="password" name="new-pass" id="new-pass"  <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'New Password' ) . '"'; ?> /><?php
     98                        if ( ! $args['single_line'] ) echo '<br/>';
     99
     100                        // CONFIRM NEW PASSWORD FIELD AND LABEL
     101                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     102                            ?><label for="new-pass-confirm"><?php _e( 'Confirm New Password' ); ?></label><?php
     103                        }
     104                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     105                        <input type="password" name="new-pass-confirm" id="new-pass-confirm"  <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Confirm New Password' ) . '"'; ?> /><?php
     106                        if ( ! $args['single_line'] ) echo '<br/>';
     107
     108                        // SUBMIT BUTTON ?>
     109                        <input type="submit" name="s8-login-reset" value="<?php echo ( $args['submit_text'] ) ? $args['submit_text'] : __( 'Change Password' ); ?>" />
    62110                    </p>
    63111                </form><?php
    64112                break;
    65             case 'forgot': // Forgot password
    66                 ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" class="s8_form forgot_form">
    67                     <?php
    68                     if(is_wp_error($errors)) {
    69                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    70                     }
    71                     elseif($errors !== false && !empty($errors) && !is_array($errors))
    72                         echo '<p class="notice">'.$errors.'</p>';
    73                     ?>
    74                     <p>
    75                         <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-forgot'); ?>" />
    76                         <label for="user_login"><?php _e('Username or Email'); ?></label>
    77                         <?php if($args['split_lines']) echo '<br/>'; ?>
    78                         <input type="text" name="user_login" id="user_login" value="<?php echo $_POST['user_login']; ?>" /><br/>
     113
     114            case 'forgot':
     115                /***** FORGOT PASSWORD FORM *****/
     116                // Output our form
     117                ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" class="s8_form forgot_form"><?php
     118                    // Output any errors we found
     119                    if ( is_wp_error( $errors ) ) {
     120                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     121                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
     122                        echo '<p class="notice">' . $errors . '</p>';
     123                    } ?>
     124                    <p>
     125                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-forgot-nonce' );
     126                        //<input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-forgot'); ? >" />
     127                        // USERNAME OR EMAIL FIELD AND LABEL
     128                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     129                            ?><label for="user_login"><?php _e( 'Username or Email Address' ); ?></label><?php
     130                        }
     131                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     132                        <input type="text" name="user_login" id="user_login" value="<?php echo $_POST['user_login']; ?>" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Username or Email Address' ) . '"'; ?> /><?php
     133                        if ( ! $args['single_line'] ) echo '<br/>';
     134
     135                        // SUBMIT BUTTON AND LINKS ?>
    79136                        <input type="submit" name="s8-login-forgot" value="Get New Password" />
    80                         <?php if($args['login'])
    81                             echo '<br/>'.s8_get_login_link();
    82                         if($args['register'] && get_option('users_can_register'))
    83                             echo '<br/>'.s8_get_register_link(s8_get_current_url()); ?>
     137                        <?php
     138                        if ( $args['login'] ) {
     139                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_login_link();
     140                        }
     141                        if ( $args['register'] && get_option( 'users_can_register' ) ) {
     142                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_register_link( s8_get_current_url() );
     143                        } ?>
    84144                    </p>
    85145                </form><?php
    86146                break;
    87             default: // Login form
    88                 $redirect_url = ($_GET['redirect'] != '')?$_GET['redirect']:s8_get_current_url();
     147
     148            default:
     149                /***** LOGIN FORM *****/
    89150                global $wp_query;
    90                 if(isset($wp_query->query_vars[s8_login_registration::ep_login]) && s8_get_current_url() == $redirect_url)
     151                // Get our redirect url
     152                $redirect_url = ( $_GET['redirect'] != '' ) ? $_GET['redirect'] : s8_get_current_url();
     153                if ( isset( $wp_query->query_vars[s8_login_registration::ep_login] ) && s8_get_current_url() == $redirect_url ) {
    91154                    $redirect_url = home_url();
    92                 ?><form action="<?php echo s8_get_login_url($redirect_url); ?>" name="login" method="post" class="s8_form login_form">
    93                     <?php
    94                     if(is_wp_error($errors)) {
    95                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    96                     }
    97                     elseif($errors !== false && !empty($errors) && !is_array($errors))
    98                         echo '<p class="notice">'.$errors.'</p>';
    99                     ?>
    100                     <p>
    101                         <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_CLR-login-nonce'); ?>" />
     155                }
     156                // Output our form
     157                ?><form action="<?php echo s8_get_login_url( $redirect_url ); ?>" name="login" method="post" class="s8_form login_form"><?php
     158                    // Output any errors we found
     159                    if ( is_wp_error( $errors ) ) {
     160                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     161                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
     162                        echo '<p class="notice">' . $errors . '</p>';
     163                    } ?>
     164                    <p>
     165                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-login-nonce' );
     166                        // <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce( 's8_CLR-login-nonce' ); ? >" />
     167                        // USERNAME FIELD AND LABEL
     168                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     169                            ?><label for="username"><?php _e( 'Username' ); ?></label><?php
     170                        }
     171                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     172                        <input type="text" name="username" id="username" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Username' ) . '"'; ?> /><?php
     173                        if ( ! $args['single_line'] ) echo '<br/>';
     174
     175                        // PASSWORD FIELD AND LABEL
     176                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     177                            ?><label for="pwd"><?php _e('Password'); ?></label><?php
     178                        }
     179                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     180                        <input type="password" name="pwd" id="pwd" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Password' ) . '"'; ?> /><?php
     181                        if ( ! $args['single_line'] ) echo '<br/>';
     182
     183                        //do_action('login_form'); // TODO: Look at integrating this and how it all works
     184
     185                        // REMEMBER ME CHECKBOX
     186                        if ( ! $args['hide_remember'] ) { ?>
     187                            <input type="checkbox" id="remember-me" name="remember" value="forever" /> <label for="remember-me"><? _e( 'Remember me' ); ?></label><?php
     188                            if ( ! $args['single_line'] ) echo '<br/>';
     189                        }
     190
     191                        // SUBMIT BUTTON AND LINKS ?>
    102192                        <input type="hidden" name="redirect" value="<?php echo $redirect_url; ?>" />
    103                         <label for="username"><?php _e('Username'); ?></label>
    104                         <?php if($args['split_lines']) echo '<br/>'; ?>
    105                         <input type="text" name="username" id="username" /><br/>
    106                         <label for="pwd"><?php _e('Password'); ?></label>
    107                         <?php if($args['split_lines']) echo '<br/>'; ?>
    108                         <input type="password" name="pwd" id="pwd" /><br/>
    109                         <?php //do_action('login_form'); ?>
    110                         <input type="checkbox" id="remember-me" name="remember" value="forever" />
    111                         <label for="remember-me"><? _e('Remember me'); ?></label><br />
    112                         <input type="submit" name="s8-login" value="<?php _e('Login'); ?>" class="login-button" />
    113                         <?php if($args['forgot'])
    114                             echo '<br/>'.s8_get_forgot_password_link();
    115                         if($args['register'] && get_option('users_can_register'))
    116                             echo '<br/>'.s8_get_register_link(s8_get_current_url()); ?>
     193                        <input type="submit" name="s8-login" value="<?php echo ( $args['submit_text'] ) ? $args['submit_text'] : __( 'Login' ); ?>" class="login-button" />
     194                        <?php
     195                        if ( $args['forgot'] ) {
     196                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_forgot_password_link();
     197                        }
     198                        if ( $args['register'] && get_option( 'users_can_register' ) ) {
     199                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_register_link( s8_get_current_url() );
     200                        } ?>
    117201                    </p>
    118202                </form>
  • s8-custom-login-and-registration/tags/0.8.5/readme.txt

    r713234 r721036  
    11=== Sideways8 Custom Login and Registration ===
    22Contributors: sideways8, technical_mastermind, areimann
    3 Tags: custom login, login, registration, form, login widget, widget
     3Tags: s8, sideways8, sideways 8, custom login, login, registration, form, login widget, widget, theme login, style login, theme, style log in, theme log in, log in, custom log in, brand, brand login, brand log in
    44Requires at least: 3.3
    55Tested up to: 3.5.1
    6 Stable tag: 0.8.4
     6Stable tag: 0.8.5
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
    99
    10 Quick and easy relocation of the login and registration forms to another page that matches your site.
     10Hides the WP login page, allows you to "embed" login in a page, and allows customization on how the login page looks.
    1111
    1212== Description ==
    1313The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. A login form widget is included to make it easy for your non-logged in visitors to find the login form. You are even able to add content to the login, registration, forgot password and password reset pages through the settings page.
    1414
    15 If you want to add a form to a page on your site, you can use the new shortcodes: `[s8-login-form]`, `[s8-registration-form]`, and `[s8-forgot-form]`.
     15If you want to add a form to a page on your site, you can use the following shortcodes: `[s8-login-form]`, `[s8-registration-form]`, and `[s8-forgot-form]`.
     16
     17Note: This plugin requires that you use pretty permalinks
    1618
    1719= Support/Help =
     
    5456
    5557== Upgrade Notice ==
     58= 0.8.5 =
     59Several major and minor bug fixes with some code improvements
    5660= 0.8.4 =
    5761Bug fix related to the password reset functionality.
     
    6670
    6771== Changelog ==
     72= 0.8.5 =
     73* Updated a function related to the login process to more effectively use WordPress' built-in methods
     74* Updated the login redirect priority to fire LATER so other plugins have the opportunity to do their own redirects
     75* Several other minor improvements and bug fixes
     76* Fixed a bug related to WordPress' default password protection of pages/posts
    6877= 0.8.4 =
    6978* Fixed a bug related to resetting a password
  • s8-custom-login-and-registration/tags/0.8.5/s8-login-registration.php

    r712965 r721036  
    44 * Plugin URI: http://sideways8.com/plugins/s8-custom-login-and-registration/
    55 * Description: The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. It also comes with a login form widget to make it easy for your non-logged in visitors to find the login form.
    6  * Tags: custom login, login, registration, form, login widget, widget
    7  * Version: 0.8.4
     6 * Tags: s8, sideways8, sideways 8, custom login, login, registration, form, login widget, widget, theme login, style login, theme, style log in, theme log in, log in, custom log in, brand, brand login, brand log in
     7 * Version: 0.8.5
    88 * Author: Sideways8 Interactive
    99 * Author URI: http://sideways8.com/
     
    1313
    1414//define('S8_LOGIN_EP', 'login');
    15 define('S8_LOGIN_FILE', __FILE__);
    16 
    17 include_once(plugin_dir_path(S8_LOGIN_FILE).'inc/forms.php');
    18 include_once(plugin_dir_path(S8_LOGIN_FILE).'inc/functions.php');
    19 include_once(plugin_dir_path(S8_LOGIN_FILE).'inc/s8-login-widget.php');
     15define( 'S8_LOGIN_FILE', __FILE__ );
     16
     17include_once( plugin_dir_path( S8_LOGIN_FILE ) . 'inc/forms.php' );
     18include_once( plugin_dir_path( S8_LOGIN_FILE ) . 'inc/functions.php' );
     19include_once( plugin_dir_path( S8_LOGIN_FILE ) . 'inc/s8-login-widget.php' );
    2020
    2121/**
     
    2626class s8_login_registration {
    2727    const ep_login = 'login';
    28     private $version = '0.8.4',
     28    private $version = '0.8.5',
    2929            $title = '404 Not Found',
    3030            $content = 'Sorry, what you are looking for could not be found!';
     
    3636    function __construct() {
    3737        // Update if needed
    38         if($this->version != get_option('s8-login-registration-version')) $this->update();
     38        if ( $this->version != get_option( 's8-login-registration-version' ) ) $this->update();
    3939        // Add our activation/deactivation hooks
    40         register_activation_hook(S8_LOGIN_FILE, array($this, 'activation'));
    41         register_deactivation_hook(S8_LOGIN_FILE, array($this, 'deactivation'));
     40        register_activation_hook( S8_LOGIN_FILE, array( $this, 'activation' ) );
     41        register_deactivation_hook( S8_LOGIN_FILE, array( $this, 'deactivation' ) );
    4242        // Add our endpoints
    43         add_action('init', array($this, 'endpoints'));
     43        add_action( 'init', array( $this, 'endpoints' ) );
    4444        // Add our posts and load the appropriate template
    45         add_action('the_posts', array($this, 'the_posts'));
    46         add_action('template_include', array($this, 'template_include'));
     45        add_action( 'the_posts', array( $this, 'the_posts' ) );
     46        add_action( 'template_include', array( $this, 'template_include' ) );
    4747        // Filter out the wrong urls in the reset password emails
    48         add_filter('retrieve_password_message', array($this, 'filter_email_urls'), 10, 2);
     48        add_filter( 'retrieve_password_message', array( $this, 'filter_email_urls' ), 10, 2 );
    4949        // Keep people from seeing the WP Login page
    50         add_action('login_init', array($this, 'no_wp_login'));
     50        add_action( 'login_init', array( $this, 'no_wp_login' ) );
    5151        // Work with the WordPress functions
    52         add_filter('logout_url', array($this, 'logout_url'), 10, 2);
    53         add_filter('login_url', array($this, 'login_url'), 10, 2);
    54         add_filter('lostpassword_url', array($this, 'forgotpassword_url'), 10, 2);
     52        add_filter( 'logout_url', array( $this, 'logout_url' ), 10, 2 );
     53        add_filter( 'login_url', array( $this, 'login_url' ), 10, 2 );
     54        add_filter( 'lostpassword_url', array( $this, 'forgotpassword_url' ), 10, 2 );
    5555        // Add our shortcodes
    56         add_shortcode('s8-login-form', array($this, 'login_shortcode'));
    57         add_shortcode('s8-registration-form', array($this, 'registration_shortcode'));
    58         add_shortcode('s8-forgot-form', array($this, 'forgot_shortcode'));
    59         add_shortcode('s8-reset-form', array($this, 'reset_shortcode')); // This is intended for internal use ONLY
     56        add_shortcode( 's8-login-form', array( $this, 'login_shortcode' ) );
     57        add_shortcode( 's8-registration-form', array( $this, 'registration_shortcode' ) );
     58        add_shortcode( 's8-forgot-form', array( $this, 'forgot_shortcode' ) );
     59        add_shortcode( 's8-reset-form', array( $this, 'reset_shortcode' ) ); // This is intended for internal use ONLY
    6060        //add_filter('register', array($this, 'register_url'));
    6161        // Add our admin stuff
    62         add_action('admin_menu', array($this, 'admin_menu'));
     62        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
     63        add_action( 'wp_login', array( $this, 'login_redirect' ), 99, 2 );
    6364    }
    6465
     
    9192            switch($_GET['action']) {
    9293                case 'register':
    93                     if(!get_option('users_can_register')) {
    94                         wp_redirect(s8_get_login_url(home_url()));
     94                    if ( ! get_option( 'users_can_register' ) ) {
     95                        wp_redirect( s8_get_login_url( home_url() ) );
    9596                        exit;
    9697                    }
    97                     if($_POST['s8-register']) {
     98                    if ( isset( $_POST['s8-register'] ) ) {
    9899                        $s8_login_errors = $this->register_user();
    99100                    }
     
    103104                    break;
    104105                case 'reset':
    105                     define('S8_LOGIN_INIT', true);
    106                     if($_POST['s8-login-reset'] == 'Change Password') {
     106                    define( 'S8_LOGIN_INIT', true );
     107                    if ( isset( $_POST['s8-login-reset'] ) ) {
    107108                        $s8_login_errors = $this->user_password_reset();
    108109                    }
    109                     $this->title = __('Reset Password');
     110                    $this->title = __( 'Reset Password' );
    110111                    $this->content = '[s8-reset-form action="reset" s8_internal="true"]';
    111112                        //$this->display_template('login');
    112113                    break;
    113114                case 'forgot':
    114                     define('S8_LOGIN_INIT', true);
    115                     if($_POST['s8-login-forgot'] == 'Get New Password') {
     115                    define( 'S8_LOGIN_INIT', true );
     116                    if ( isset( $_POST['s8-login-forgot'] ) ) {
    116117                        $s8_login_errors = $this->user_password_reset_request();
    117118                    }
    118                     $this->title = __('Forgot Password');
     119                    $this->title = __( 'Forgot Password' );
    119120                    $this->content = '[s8-forgot-form s8_internal="true"]';
    120121                        //$this->display_template('login');
     
    122123                default:
    123124                    // Check if we are processing (and process if needed)
    124                     if($_POST['s8-login'] == 'Login') {
     125                    if ( isset( $_POST['s8-login'] ) ) {
    125126                        $s8_login_errors = $this->login_user();
    126127                    }
     
    150151
    151152    /**
    152      *
    153      */
    154     function template_include($template) {
     153     * Changes the template used for the form pages
     154     * @param string $template
     155     * @return string
     156     * @since 0.8.3
     157     */
     158    function template_include( $template ) {
    155159        global $wp_query;
    156         if(!isset($wp_query->query_vars[self::ep_login])) return $template;
    157         $order = array('s8-login.php', 'page.php', 'index.php');
    158         if($temp = get_option('s8_custom_login_form_template'))
    159             $order = array($temp, 's8-login.php', 'page.php', 'index.php');
    160         $child_theme = get_stylesheet_directory();
    161         $parent_theme = get_template_directory();
    162         if($child_theme == $parent_theme) {
    163             // Same theme!
    164             foreach($order as $temp_file) {
    165                 if(file_exists($parent_theme.'/'.$temp_file))
    166                     return $parent_theme.'/'.$temp_file;
    167             }
    168         }
    169         else {
    170             // Check child then parent
    171             foreach($order as $temp_file) {
    172                 if(file_exists($child_theme.'/'.$temp_file))
    173                     return $child_theme.'/'.$temp_file;
    174                 elseif(file_exists($parent_theme.'/'.$temp_file))
    175                     return $parent_theme.'/'.$temp_file;
    176             }
     160        if ( isset( $wp_query->query_vars[self::ep_login] ) ) {
     161            $order = array( 's8-login.php', 'page.php', 'index.php' );
     162            if ( $temp = get_option( 's8_custom_login_form_template' ) )
     163                $order = array( $temp, 's8-login.php', 'page.php', 'index.php' );
     164            $template = locate_template( $order );
    177165        }
    178166        // If we fail to find an appropriate file, return what WP was going to use anyways.
     
    186174     */
    187175    function register_user() {
    188         if(!wp_verify_nonce($_POST['s8-register-nonce'], 's8-register-new-user')) die('An attempt to bypass security checks was detected! Please go back to the register form and try again.');
     176        if ( ! wp_verify_nonce( $_POST['s8-clr-register-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     177            die('An attempt to bypass security checks was detected! Please go back to the register form and try again.');
    189178        // Verify our data
    190179        if(empty($_POST['username']) || empty($_POST['email']))
     
    225214     */
    226215    function user_password_reset() {
    227         if(!wp_verify_nonce($_POST['s8-login-nonce'], 's8_wp_custom_login-nonce-reset')) die('An attempt to bypass security checks was detected! Please go back to the password reset and try again.');
     216        if ( ! wp_verify_nonce( $_POST['s8-clr-reset-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     217            die('An attempt to bypass security checks was detected! Please go back to the password reset and try again.');
    228218        // We are updating our password!
    229219        ob_start();
     
    251241     */
    252242    function user_password_reset_request() {
    253         if(!wp_verify_nonce($_POST['s8-login-nonce'], 's8_wp_custom_login-nonce-forgot')) die('An attempt to bypass security checks was detected! Please go back to the forgot password form and try again.');
     243        if ( ! wp_verify_nonce( $_POST['s8-clr-forgot-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     244            die('An attempt to bypass security checks was detected! Please go back to the forgot password form, refresh the page, and try again.');
    254245        // We are requesting a password reset!
    255246        ob_start();
     
    268259     */
    269260    function login_user() {
    270         if(!wp_verify_nonce($_POST['s8-login-nonce'], 's8_CLR-login-nonce')) die('An attempt to bypass security checks was detected! Please go back to the login form and try again.');
    271         // We are logging in!
    272         $username = sanitize_user($_POST['username']);
    273         $user = wp_authenticate($username, $_POST['pwd']);
    274         if(is_wp_error($user))
    275             return $user;
    276         elseif($user && is_object($user) && $user->data->user_login == $username) {
    277             if($_POST['remember'] == 'forever') $remember = true;
    278             else $remember = false;
    279             wp_set_current_user($user->ID, $username);
    280             wp_set_auth_cookie($user->ID, $remember);
    281             do_action('wp_login', $username);
    282             // Check for custom redirect
    283             global $current_user;
    284             $redirects = get_option('s8_login_redirects');
    285             $role = $current_user->roles;
    286             if(is_array($role)) $role = $role[0];
    287             // Do our redirect!
    288             if(isset($redirects[$role])) $url = $redirects[$role];
    289             elseif($_POST['redirect'] != '') $url = $_POST['redirect'];
    290             else $url = home_url('/');
    291             wp_redirect($url, 302);
    292             exit;
    293         }
    294         else {
    295             return new WP_Error('unexpected', 'An unexpected error occurred!');
    296         }
     261        if ( ! wp_verify_nonce( $_POST['s8-clr-login-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     262            die( 'An attempt to bypass security checks was detected! Please go back to the login form, refresh the page, and try again.' );
     263        $credentials = array(
     264            'user_login' => sanitize_user( $_POST['username'] ),
     265            'user_password' => $_POST['pwd'],
     266            'remember' => ( empty( $_POST['remember'] ) ? false : true )
     267        );
     268        $user = wp_signon( $credentials );
     269        return $user;
     270    }
     271
     272    /**
     273     * This handles the redirection of our users after login, this was split off from our login_user function
     274     * @param $user_login
     275     * @param $user
     276     * @since 0.8.5
     277     */
     278    function login_redirect( $user_login, $user ) {
     279        // Check for custom redirect
     280        $redirects = get_option('s8_login_redirects');
     281        $role = $user->roles;
     282        // Grab the first user role
     283        if ( is_array( $role ) )
     284            $role = $role[0];
     285        // Setup our redirect URL
     286        if ( isset( $redirects[$role] ) ) {
     287            $url = $redirects[$role];
     288        } elseif ( $_POST['redirect'] != '' ) {
     289            $url = $_POST['redirect'];
     290        } else {
     291            $url = home_url('/');
     292        }
     293        // Redirect and exit to avoid errors
     294        wp_redirect( $url, 302 );
     295        exit;
    297296    }
    298297
     
    302301     */
    303302    function no_wp_login() {
    304         if(defined('S8_LOGIN_INIT') && S8_LOGIN_INIT === true) return;
    305         $check = get_option('s8_allow_wp_register');
    306         if($check && $_REQUEST['action'] == 'register') return;
    307         if($_GET['no-redirect'] == 'true') {
    308             wp_enqueue_script('s8-login-failsafe', plugins_url('/js/s8-login-failsafe.js', S8_LOGIN_FILE), array('jquery'));
     303        // This does something important...
     304        if ( defined( 'S8_LOGIN_INIT' ) && S8_LOGIN_INIT === true )
    309305            return;
    310         }
    311         if($_GET['redirect_to'] != '') $url = $_GET['redirect_to'];
    312         else $url = false;
    313         if($_GET['action'] == 'logout')
    314             wp_redirect(s8_get_logout_url($url));
    315         elseif($_GET['action'] == 'register')
    316             wp_redirect(s8_get_register_url($url));
    317         else
    318             wp_redirect(s8_get_login_url($url));
     306        // See if we are trying to register and want to use the WP registration form
     307        $check = get_option( 's8_allow_wp_register' );
     308        if ( $check && $_REQUEST['action'] == 'register' )
     309            return;
     310        // Check if this is validation for a password protected post/page
     311        if ( $_GET['action'] == 'postpass' )
     312            return;
     313        // See if we are in no-redirect mode
     314        if ( $_GET['no-redirect'] == 'true' ) {
     315            wp_enqueue_script( 's8-login-failsafe', plugins_url( '/js/s8-login-failsafe.js', S8_LOGIN_FILE ), array( 'jquery' ) );
     316            return;
     317        }
     318        // Let's check for a redirect value
     319        if ( $_GET['redirect_to'] != '' ) {
     320            $url = $_GET['redirect_to'];
     321        } else {
     322            $url = false;
     323        }
     324        // Redirect away from the WP login page
     325        if ( $_GET['action'] == 'logout' ) {
     326            wp_redirect( s8_get_logout_url( $url ) );
     327        } elseif ( $_GET['action'] == 'register' ) {
     328            wp_redirect( s8_get_register_url( $url ) );
     329        } else {
     330            wp_redirect( s8_get_login_url( $url ) );
     331        }
    319332        exit;
    320333    }
  • s8-custom-login-and-registration/trunk/inc/forms.php

    r712965 r721036  
    44 */
    55
    6 if(!function_exists('s8_clr_get_form')):
     6if ( ! function_exists( 's8_clr_get_form' ) ):
    77    /**
    88     * Echos out the requested form
    99     * @since 0.8.1
    1010     */
    11     function s8_clr_get_form($form = 'login', $args = array(), $errors = false) {
     11    function s8_clr_get_form( $form = 'login', $args = array(), $errors = false ) {
    1212        global $s8_login_errors;
    13         if($errors === false)
     13        $args = array_merge( array(
     14            // Work on ANY form
     15            'split_lines' => false, // This splits the labels and form fields onto separate lines
     16            'single_line' => false, // This, when true, displays the entire form without any line breaks
     17            'use_html5_placeholders' => false, // When true, labels become HTML5 placeholder text instead
     18            'submit_text' => false, // This changes the submit button text, false uses the forms default value
     19
     20            // Works only on login form
     21            'hide_remember' => false, // Login form specific, hides the "Remember me" checkbox
     22        ), $args );
     23        if ( $errors === false ) {
    1424            $errors = $s8_login_errors;
    15         switch($form) {
    16             case 'register': // Register user
    17                 $redirect_url = ($_GET['redirect'] != '')?$_GET['redirect']:home_url();
    18                 ?><form method="post" action="<?php echo s8_get_register_url($redirect_url); ?>" name="register" class="s8_form register_form">
    19                     <?php
    20                     if(is_wp_error($errors)) {
    21                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    22                     }
    23                     elseif($errors !== false && !empty($errors) && !is_array($errors))
     25        }
     26        // Pick the right form
     27        switch ( $form ) {
     28            case 'register':
     29                /***** REGISTRATION FORM *****/
     30                $redirect_url = ( $_GET['redirect'] != '' ) ? $_GET['redirect'] : home_url();
     31                // Output our form
     32                ?><form method="post" action="<?php echo s8_get_register_url( $redirect_url ); ?>" name="register" class="s8_form register_form"><?php
     33                    // Output any errors we find
     34                    if ( is_wp_error( $errors ) ) {
     35                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     36                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
    2437                        echo '<p class="notice">'.$errors.'</p>';
    25                     ?>
    26                     <p>
    27                         <input type="hidden" name="s8-register-nonce" value="<?php echo wp_create_nonce('s8-register-new-user') ?>" />
    28                         <label for="username"><?php _e('Username'); ?></label>
    29                         <?php if($args['split_lines']) echo '<br/>'; ?>
    30                         <input type="text" name="username" id="username" value="<?php echo $_POST['username']; ?>" required="required" /><br/>
    31                         <label for="email"><?php _e('Email Address'); ?></label>
    32                         <?php if($args['split_lines']) echo '<br/>'; ?>
    33                         <input type="email" name="email" id="email" value="<?php echo $_POST['email']; ?>" required="required" /><br/>
    34                         A password will be e-mailed to you.<br/>
    35                         <input type="hidden" name="redirect" value="<?php echo $redirect_url?$redirect_url:''; ?>" />
    36                         <input type="submit" name="s8-register" value="Register" />
    37                         <?php if($args['login'])
    38                             echo '<br/>'.s8_get_login_link(false);
    39                         if($args['forgot'])
    40                             echo '<br/>'.s8_get_forgot_password_link(s8_get_current_url()); ?>
     38                    } ?>
     39                    <p>
     40                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-register-nonce' );
     41                        //<input type="hidden" name="s8-register-nonce" value="<?php echo wp_create_nonce('s8-register-new-user') ? >" />
     42
     43                        // USERNAME FIELD AND LABEL
     44                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     45                            ?><label for="username"><?php _e( 'Username' ); ?></label><?php
     46                        }
     47                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     48                        <input type="text" name="username" id="username" value="<?php echo $_POST['username']; ?>" required="required" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Username' ) . '"'; ?> /><?php
     49                        if ( ! $args['single_line'] ) echo '<br/>';
     50
     51                        // EMAIL ADDRESS FIELD AND LABEL
     52                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     53                            ?><label for="email"><?php _e( 'Email Address' ); ?></label><?php
     54                        }
     55                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     56                        <input type="email" name="email" id="email" value="<?php echo $_POST['email']; ?>" required="required" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Email Address' ) . '"'; ?> /><?php
     57                        if ( ! $args['single_line'] ) echo '<br/>';
     58
     59                        // PASSWORD NOTICE
     60                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>';
     61                        _e( 'A password will be e-mailed to you.' );
     62                        if ( ! $args['single_line'] ) echo '<br/>';
     63
     64                        // SUBMIT BUTTON AND LINKS ?>
     65                        <input type="hidden" name="redirect" value="<?php echo $redirect_url; ?>" />
     66                        <input type="submit" name="s8-register" value="<?php echo ( $args['submit_text'] ) ? $args['submit_text'] : __( 'Register' ); ?>" />
     67                        <?php
     68                        if ( $args['login'] ) {
     69                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_login_link( false );
     70                        }
     71                        if ( $args['forgot'] ) {
     72                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_forgot_password_link( s8_get_current_url() );
     73                        } ?>
    4174                    </p>
    4275                </form><?php
    4376                break;
    44             case 'reset': // Password reset
    45                 ?><form name="pass-reset" action="<?php echo home_url('/'.s8_login_registration::ep_login.'/?action=reset&key='.$_GET['key'].'&login='.$_GET['login']); ?>" method="post" class="s8_form reset_form">
    46                     <?php
    47                     if(is_wp_error($errors)) {
    48                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    49                     }
    50                     elseif($errors !== false && !empty($errors) && !is_array($errors))
    51                         echo '<p class="notice">'.$errors.'</p>';
    52                     ?>
    53                     <p>
    54                         <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-reset'); ?>" />
    55                         <label for="new-pass"><?php _e('New Password'); ?></label>
    56                         <?php if($args['split_lines']) echo '<br/>'; ?>
    57                         <input type="password" name="new-pass" id="new-pass" /><br/>
    58                         <label for="new-pass-confirm"><?php _e('Confirm New Password'); ?></label>
    59                         <?php if($args['split_lines']) echo '<br/>'; ?>
    60                         <input type="password" name="new-pass-confirm" id="new-pass-confirm" /><br/>
    61                         <input type="submit" name="s8-login-reset" value="Change Password" />
     77
     78            case 'reset':
     79                /***** PASSWORD RESET FORM *****/
     80                // Output our form
     81                ?><form name="pass-reset" action="<?php echo home_url( '/' . s8_login_registration::ep_login . '/?action=reset&key=' . $_GET['key'] . '&login=' . $_GET['login'] ); ?>" method="post" class="s8_form reset_form"><?php
     82                    // Output any errors we found
     83                    if ( is_wp_error( $errors ) ) {
     84                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     85                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
     86                        echo '<p class="notice">' . $errors . '</p>';
     87                    } ?>
     88                    <p>
     89                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-reset-nonce' );
     90                        // <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-reset'); ? >" />
     91
     92                        // NEW PASSWORD FIELD AND LABEL
     93                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     94                            ?><label for="new-pass"><?php _e( 'New Password' ); ?></label><?php
     95                        }
     96                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     97                        <input type="password" name="new-pass" id="new-pass"  <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'New Password' ) . '"'; ?> /><?php
     98                        if ( ! $args['single_line'] ) echo '<br/>';
     99
     100                        // CONFIRM NEW PASSWORD FIELD AND LABEL
     101                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     102                            ?><label for="new-pass-confirm"><?php _e( 'Confirm New Password' ); ?></label><?php
     103                        }
     104                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     105                        <input type="password" name="new-pass-confirm" id="new-pass-confirm"  <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Confirm New Password' ) . '"'; ?> /><?php
     106                        if ( ! $args['single_line'] ) echo '<br/>';
     107
     108                        // SUBMIT BUTTON ?>
     109                        <input type="submit" name="s8-login-reset" value="<?php echo ( $args['submit_text'] ) ? $args['submit_text'] : __( 'Change Password' ); ?>" />
    62110                    </p>
    63111                </form><?php
    64112                break;
    65             case 'forgot': // Forgot password
    66                 ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" class="s8_form forgot_form">
    67                     <?php
    68                     if(is_wp_error($errors)) {
    69                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    70                     }
    71                     elseif($errors !== false && !empty($errors) && !is_array($errors))
    72                         echo '<p class="notice">'.$errors.'</p>';
    73                     ?>
    74                     <p>
    75                         <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-forgot'); ?>" />
    76                         <label for="user_login"><?php _e('Username or Email'); ?></label>
    77                         <?php if($args['split_lines']) echo '<br/>'; ?>
    78                         <input type="text" name="user_login" id="user_login" value="<?php echo $_POST['user_login']; ?>" /><br/>
     113
     114            case 'forgot':
     115                /***** FORGOT PASSWORD FORM *****/
     116                // Output our form
     117                ?><form name="forgot" action="<?php echo s8_get_forgot_password_url(); ?>" method="post" class="s8_form forgot_form"><?php
     118                    // Output any errors we found
     119                    if ( is_wp_error( $errors ) ) {
     120                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     121                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
     122                        echo '<p class="notice">' . $errors . '</p>';
     123                    } ?>
     124                    <p>
     125                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-forgot-nonce' );
     126                        //<input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_wp_custom_login-nonce-forgot'); ? >" />
     127                        // USERNAME OR EMAIL FIELD AND LABEL
     128                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     129                            ?><label for="user_login"><?php _e( 'Username or Email Address' ); ?></label><?php
     130                        }
     131                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     132                        <input type="text" name="user_login" id="user_login" value="<?php echo $_POST['user_login']; ?>" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Username or Email Address' ) . '"'; ?> /><?php
     133                        if ( ! $args['single_line'] ) echo '<br/>';
     134
     135                        // SUBMIT BUTTON AND LINKS ?>
    79136                        <input type="submit" name="s8-login-forgot" value="Get New Password" />
    80                         <?php if($args['login'])
    81                             echo '<br/>'.s8_get_login_link();
    82                         if($args['register'] && get_option('users_can_register'))
    83                             echo '<br/>'.s8_get_register_link(s8_get_current_url()); ?>
     137                        <?php
     138                        if ( $args['login'] ) {
     139                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_login_link();
     140                        }
     141                        if ( $args['register'] && get_option( 'users_can_register' ) ) {
     142                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_register_link( s8_get_current_url() );
     143                        } ?>
    84144                    </p>
    85145                </form><?php
    86146                break;
    87             default: // Login form
    88                 $redirect_url = ($_GET['redirect'] != '')?$_GET['redirect']:s8_get_current_url();
     147
     148            default:
     149                /***** LOGIN FORM *****/
    89150                global $wp_query;
    90                 if(isset($wp_query->query_vars[s8_login_registration::ep_login]) && s8_get_current_url() == $redirect_url)
     151                // Get our redirect url
     152                $redirect_url = ( $_GET['redirect'] != '' ) ? $_GET['redirect'] : s8_get_current_url();
     153                if ( isset( $wp_query->query_vars[s8_login_registration::ep_login] ) && s8_get_current_url() == $redirect_url ) {
    91154                    $redirect_url = home_url();
    92                 ?><form action="<?php echo s8_get_login_url($redirect_url); ?>" name="login" method="post" class="s8_form login_form">
    93                     <?php
    94                     if(is_wp_error($errors)) {
    95                         echo '<p class="error">'.$errors->get_error_message().'</p>';
    96                     }
    97                     elseif($errors !== false && !empty($errors) && !is_array($errors))
    98                         echo '<p class="notice">'.$errors.'</p>';
    99                     ?>
    100                     <p>
    101                         <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce('s8_CLR-login-nonce'); ?>" />
     155                }
     156                // Output our form
     157                ?><form action="<?php echo s8_get_login_url( $redirect_url ); ?>" name="login" method="post" class="s8_form login_form"><?php
     158                    // Output any errors we found
     159                    if ( is_wp_error( $errors ) ) {
     160                        echo '<p class="error">' . $errors->get_error_message() . '</p>';
     161                    } elseif ( $errors !== false && ! empty( $errors ) && ! is_array( $errors ) ) {
     162                        echo '<p class="notice">' . $errors . '</p>';
     163                    } ?>
     164                    <p>
     165                        <?php wp_nonce_field( plugin_dir_path( S8_LOGIN_FILE ), 's8-clr-login-nonce' );
     166                        // <input type="hidden" name="s8-login-nonce" value="<?php echo wp_create_nonce( 's8_CLR-login-nonce' ); ? >" />
     167                        // USERNAME FIELD AND LABEL
     168                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     169                            ?><label for="username"><?php _e( 'Username' ); ?></label><?php
     170                        }
     171                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     172                        <input type="text" name="username" id="username" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Username' ) . '"'; ?> /><?php
     173                        if ( ! $args['single_line'] ) echo '<br/>';
     174
     175                        // PASSWORD FIELD AND LABEL
     176                        if ( ! $args['use_html5_placeholders'] ) { // Don't display if we are using html5 placeholders
     177                            ?><label for="pwd"><?php _e('Password'); ?></label><?php
     178                        }
     179                        if ( $args['split_lines'] && ! $args['single_line'] ) echo '<br/>'; ?>
     180                        <input type="password" name="pwd" id="pwd" <?php if ( $args['use_html5_placeholders'] ) echo 'placeholder="' . __( 'Password' ) . '"'; ?> /><?php
     181                        if ( ! $args['single_line'] ) echo '<br/>';
     182
     183                        //do_action('login_form'); // TODO: Look at integrating this and how it all works
     184
     185                        // REMEMBER ME CHECKBOX
     186                        if ( ! $args['hide_remember'] ) { ?>
     187                            <input type="checkbox" id="remember-me" name="remember" value="forever" /> <label for="remember-me"><? _e( 'Remember me' ); ?></label><?php
     188                            if ( ! $args['single_line'] ) echo '<br/>';
     189                        }
     190
     191                        // SUBMIT BUTTON AND LINKS ?>
    102192                        <input type="hidden" name="redirect" value="<?php echo $redirect_url; ?>" />
    103                         <label for="username"><?php _e('Username'); ?></label>
    104                         <?php if($args['split_lines']) echo '<br/>'; ?>
    105                         <input type="text" name="username" id="username" /><br/>
    106                         <label for="pwd"><?php _e('Password'); ?></label>
    107                         <?php if($args['split_lines']) echo '<br/>'; ?>
    108                         <input type="password" name="pwd" id="pwd" /><br/>
    109                         <?php //do_action('login_form'); ?>
    110                         <input type="checkbox" id="remember-me" name="remember" value="forever" />
    111                         <label for="remember-me"><? _e('Remember me'); ?></label><br />
    112                         <input type="submit" name="s8-login" value="<?php _e('Login'); ?>" class="login-button" />
    113                         <?php if($args['forgot'])
    114                             echo '<br/>'.s8_get_forgot_password_link();
    115                         if($args['register'] && get_option('users_can_register'))
    116                             echo '<br/>'.s8_get_register_link(s8_get_current_url()); ?>
     193                        <input type="submit" name="s8-login" value="<?php echo ( $args['submit_text'] ) ? $args['submit_text'] : __( 'Login' ); ?>" class="login-button" />
     194                        <?php
     195                        if ( $args['forgot'] ) {
     196                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_forgot_password_link();
     197                        }
     198                        if ( $args['register'] && get_option( 'users_can_register' ) ) {
     199                            echo ( $args['single_line'] ? '' : '<br/>' ) . s8_get_register_link( s8_get_current_url() );
     200                        } ?>
    117201                    </p>
    118202                </form>
  • s8-custom-login-and-registration/trunk/readme.txt

    r713234 r721036  
    11=== Sideways8 Custom Login and Registration ===
    22Contributors: sideways8, technical_mastermind, areimann
    3 Tags: custom login, login, registration, form, login widget, widget
     3Tags: s8, sideways8, sideways 8, custom login, login, registration, form, login widget, widget, theme login, style login, theme, style log in, theme log in, log in, custom log in, brand, brand login, brand log in
    44Requires at least: 3.3
    55Tested up to: 3.5.1
    6 Stable tag: 0.8.4
     6Stable tag: 0.8.5
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
    99
    10 Quick and easy relocation of the login and registration forms to another page that matches your site.
     10Hides the WP login page, allows you to "embed" login in a page, and allows customization on how the login page looks.
    1111
    1212== Description ==
    1313The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. A login form widget is included to make it easy for your non-logged in visitors to find the login form. You are even able to add content to the login, registration, forgot password and password reset pages through the settings page.
    1414
    15 If you want to add a form to a page on your site, you can use the new shortcodes: `[s8-login-form]`, `[s8-registration-form]`, and `[s8-forgot-form]`.
     15If you want to add a form to a page on your site, you can use the following shortcodes: `[s8-login-form]`, `[s8-registration-form]`, and `[s8-forgot-form]`.
     16
     17Note: This plugin requires that you use pretty permalinks
    1618
    1719= Support/Help =
     
    5456
    5557== Upgrade Notice ==
     58= 0.8.5 =
     59Several major and minor bug fixes with some code improvements
    5660= 0.8.4 =
    5761Bug fix related to the password reset functionality.
     
    6670
    6771== Changelog ==
     72= 0.8.5 =
     73* Updated a function related to the login process to more effectively use WordPress' built-in methods
     74* Updated the login redirect priority to fire LATER so other plugins have the opportunity to do their own redirects
     75* Several other minor improvements and bug fixes
     76* Fixed a bug related to WordPress' default password protection of pages/posts
    6877= 0.8.4 =
    6978* Fixed a bug related to resetting a password
  • s8-custom-login-and-registration/trunk/s8-login-registration.php

    r712965 r721036  
    44 * Plugin URI: http://sideways8.com/plugins/s8-custom-login-and-registration/
    55 * Description: The way your site is presented to your users is important. That is why we made the "Custom Login and Registration" plugin. It is designed so that both you and your users never see the built-in WP login, registration, and password reset forms. It is still compatible with all of WordPress' built-in functionality and logout links will still function as they should. It also comes with a login form widget to make it easy for your non-logged in visitors to find the login form.
    6  * Tags: custom login, login, registration, form, login widget, widget
    7  * Version: 0.8.4
     6 * Tags: s8, sideways8, sideways 8, custom login, login, registration, form, login widget, widget, theme login, style login, theme, style log in, theme log in, log in, custom log in, brand, brand login, brand log in
     7 * Version: 0.8.5
    88 * Author: Sideways8 Interactive
    99 * Author URI: http://sideways8.com/
     
    1313
    1414//define('S8_LOGIN_EP', 'login');
    15 define('S8_LOGIN_FILE', __FILE__);
    16 
    17 include_once(plugin_dir_path(S8_LOGIN_FILE).'inc/forms.php');
    18 include_once(plugin_dir_path(S8_LOGIN_FILE).'inc/functions.php');
    19 include_once(plugin_dir_path(S8_LOGIN_FILE).'inc/s8-login-widget.php');
     15define( 'S8_LOGIN_FILE', __FILE__ );
     16
     17include_once( plugin_dir_path( S8_LOGIN_FILE ) . 'inc/forms.php' );
     18include_once( plugin_dir_path( S8_LOGIN_FILE ) . 'inc/functions.php' );
     19include_once( plugin_dir_path( S8_LOGIN_FILE ) . 'inc/s8-login-widget.php' );
    2020
    2121/**
     
    2626class s8_login_registration {
    2727    const ep_login = 'login';
    28     private $version = '0.8.4',
     28    private $version = '0.8.5',
    2929            $title = '404 Not Found',
    3030            $content = 'Sorry, what you are looking for could not be found!';
     
    3636    function __construct() {
    3737        // Update if needed
    38         if($this->version != get_option('s8-login-registration-version')) $this->update();
     38        if ( $this->version != get_option( 's8-login-registration-version' ) ) $this->update();
    3939        // Add our activation/deactivation hooks
    40         register_activation_hook(S8_LOGIN_FILE, array($this, 'activation'));
    41         register_deactivation_hook(S8_LOGIN_FILE, array($this, 'deactivation'));
     40        register_activation_hook( S8_LOGIN_FILE, array( $this, 'activation' ) );
     41        register_deactivation_hook( S8_LOGIN_FILE, array( $this, 'deactivation' ) );
    4242        // Add our endpoints
    43         add_action('init', array($this, 'endpoints'));
     43        add_action( 'init', array( $this, 'endpoints' ) );
    4444        // Add our posts and load the appropriate template
    45         add_action('the_posts', array($this, 'the_posts'));
    46         add_action('template_include', array($this, 'template_include'));
     45        add_action( 'the_posts', array( $this, 'the_posts' ) );
     46        add_action( 'template_include', array( $this, 'template_include' ) );
    4747        // Filter out the wrong urls in the reset password emails
    48         add_filter('retrieve_password_message', array($this, 'filter_email_urls'), 10, 2);
     48        add_filter( 'retrieve_password_message', array( $this, 'filter_email_urls' ), 10, 2 );
    4949        // Keep people from seeing the WP Login page
    50         add_action('login_init', array($this, 'no_wp_login'));
     50        add_action( 'login_init', array( $this, 'no_wp_login' ) );
    5151        // Work with the WordPress functions
    52         add_filter('logout_url', array($this, 'logout_url'), 10, 2);
    53         add_filter('login_url', array($this, 'login_url'), 10, 2);
    54         add_filter('lostpassword_url', array($this, 'forgotpassword_url'), 10, 2);
     52        add_filter( 'logout_url', array( $this, 'logout_url' ), 10, 2 );
     53        add_filter( 'login_url', array( $this, 'login_url' ), 10, 2 );
     54        add_filter( 'lostpassword_url', array( $this, 'forgotpassword_url' ), 10, 2 );
    5555        // Add our shortcodes
    56         add_shortcode('s8-login-form', array($this, 'login_shortcode'));
    57         add_shortcode('s8-registration-form', array($this, 'registration_shortcode'));
    58         add_shortcode('s8-forgot-form', array($this, 'forgot_shortcode'));
    59         add_shortcode('s8-reset-form', array($this, 'reset_shortcode')); // This is intended for internal use ONLY
     56        add_shortcode( 's8-login-form', array( $this, 'login_shortcode' ) );
     57        add_shortcode( 's8-registration-form', array( $this, 'registration_shortcode' ) );
     58        add_shortcode( 's8-forgot-form', array( $this, 'forgot_shortcode' ) );
     59        add_shortcode( 's8-reset-form', array( $this, 'reset_shortcode' ) ); // This is intended for internal use ONLY
    6060        //add_filter('register', array($this, 'register_url'));
    6161        // Add our admin stuff
    62         add_action('admin_menu', array($this, 'admin_menu'));
     62        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
     63        add_action( 'wp_login', array( $this, 'login_redirect' ), 99, 2 );
    6364    }
    6465
     
    9192            switch($_GET['action']) {
    9293                case 'register':
    93                     if(!get_option('users_can_register')) {
    94                         wp_redirect(s8_get_login_url(home_url()));
     94                    if ( ! get_option( 'users_can_register' ) ) {
     95                        wp_redirect( s8_get_login_url( home_url() ) );
    9596                        exit;
    9697                    }
    97                     if($_POST['s8-register']) {
     98                    if ( isset( $_POST['s8-register'] ) ) {
    9899                        $s8_login_errors = $this->register_user();
    99100                    }
     
    103104                    break;
    104105                case 'reset':
    105                     define('S8_LOGIN_INIT', true);
    106                     if($_POST['s8-login-reset'] == 'Change Password') {
     106                    define( 'S8_LOGIN_INIT', true );
     107                    if ( isset( $_POST['s8-login-reset'] ) ) {
    107108                        $s8_login_errors = $this->user_password_reset();
    108109                    }
    109                     $this->title = __('Reset Password');
     110                    $this->title = __( 'Reset Password' );
    110111                    $this->content = '[s8-reset-form action="reset" s8_internal="true"]';
    111112                        //$this->display_template('login');
    112113                    break;
    113114                case 'forgot':
    114                     define('S8_LOGIN_INIT', true);
    115                     if($_POST['s8-login-forgot'] == 'Get New Password') {
     115                    define( 'S8_LOGIN_INIT', true );
     116                    if ( isset( $_POST['s8-login-forgot'] ) ) {
    116117                        $s8_login_errors = $this->user_password_reset_request();
    117118                    }
    118                     $this->title = __('Forgot Password');
     119                    $this->title = __( 'Forgot Password' );
    119120                    $this->content = '[s8-forgot-form s8_internal="true"]';
    120121                        //$this->display_template('login');
     
    122123                default:
    123124                    // Check if we are processing (and process if needed)
    124                     if($_POST['s8-login'] == 'Login') {
     125                    if ( isset( $_POST['s8-login'] ) ) {
    125126                        $s8_login_errors = $this->login_user();
    126127                    }
     
    150151
    151152    /**
    152      *
    153      */
    154     function template_include($template) {
     153     * Changes the template used for the form pages
     154     * @param string $template
     155     * @return string
     156     * @since 0.8.3
     157     */
     158    function template_include( $template ) {
    155159        global $wp_query;
    156         if(!isset($wp_query->query_vars[self::ep_login])) return $template;
    157         $order = array('s8-login.php', 'page.php', 'index.php');
    158         if($temp = get_option('s8_custom_login_form_template'))
    159             $order = array($temp, 's8-login.php', 'page.php', 'index.php');
    160         $child_theme = get_stylesheet_directory();
    161         $parent_theme = get_template_directory();
    162         if($child_theme == $parent_theme) {
    163             // Same theme!
    164             foreach($order as $temp_file) {
    165                 if(file_exists($parent_theme.'/'.$temp_file))
    166                     return $parent_theme.'/'.$temp_file;
    167             }
    168         }
    169         else {
    170             // Check child then parent
    171             foreach($order as $temp_file) {
    172                 if(file_exists($child_theme.'/'.$temp_file))
    173                     return $child_theme.'/'.$temp_file;
    174                 elseif(file_exists($parent_theme.'/'.$temp_file))
    175                     return $parent_theme.'/'.$temp_file;
    176             }
     160        if ( isset( $wp_query->query_vars[self::ep_login] ) ) {
     161            $order = array( 's8-login.php', 'page.php', 'index.php' );
     162            if ( $temp = get_option( 's8_custom_login_form_template' ) )
     163                $order = array( $temp, 's8-login.php', 'page.php', 'index.php' );
     164            $template = locate_template( $order );
    177165        }
    178166        // If we fail to find an appropriate file, return what WP was going to use anyways.
     
    186174     */
    187175    function register_user() {
    188         if(!wp_verify_nonce($_POST['s8-register-nonce'], 's8-register-new-user')) die('An attempt to bypass security checks was detected! Please go back to the register form and try again.');
     176        if ( ! wp_verify_nonce( $_POST['s8-clr-register-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     177            die('An attempt to bypass security checks was detected! Please go back to the register form and try again.');
    189178        // Verify our data
    190179        if(empty($_POST['username']) || empty($_POST['email']))
     
    225214     */
    226215    function user_password_reset() {
    227         if(!wp_verify_nonce($_POST['s8-login-nonce'], 's8_wp_custom_login-nonce-reset')) die('An attempt to bypass security checks was detected! Please go back to the password reset and try again.');
     216        if ( ! wp_verify_nonce( $_POST['s8-clr-reset-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     217            die('An attempt to bypass security checks was detected! Please go back to the password reset and try again.');
    228218        // We are updating our password!
    229219        ob_start();
     
    251241     */
    252242    function user_password_reset_request() {
    253         if(!wp_verify_nonce($_POST['s8-login-nonce'], 's8_wp_custom_login-nonce-forgot')) die('An attempt to bypass security checks was detected! Please go back to the forgot password form and try again.');
     243        if ( ! wp_verify_nonce( $_POST['s8-clr-forgot-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     244            die('An attempt to bypass security checks was detected! Please go back to the forgot password form, refresh the page, and try again.');
    254245        // We are requesting a password reset!
    255246        ob_start();
     
    268259     */
    269260    function login_user() {
    270         if(!wp_verify_nonce($_POST['s8-login-nonce'], 's8_CLR-login-nonce')) die('An attempt to bypass security checks was detected! Please go back to the login form and try again.');
    271         // We are logging in!
    272         $username = sanitize_user($_POST['username']);
    273         $user = wp_authenticate($username, $_POST['pwd']);
    274         if(is_wp_error($user))
    275             return $user;
    276         elseif($user && is_object($user) && $user->data->user_login == $username) {
    277             if($_POST['remember'] == 'forever') $remember = true;
    278             else $remember = false;
    279             wp_set_current_user($user->ID, $username);
    280             wp_set_auth_cookie($user->ID, $remember);
    281             do_action('wp_login', $username);
    282             // Check for custom redirect
    283             global $current_user;
    284             $redirects = get_option('s8_login_redirects');
    285             $role = $current_user->roles;
    286             if(is_array($role)) $role = $role[0];
    287             // Do our redirect!
    288             if(isset($redirects[$role])) $url = $redirects[$role];
    289             elseif($_POST['redirect'] != '') $url = $_POST['redirect'];
    290             else $url = home_url('/');
    291             wp_redirect($url, 302);
    292             exit;
    293         }
    294         else {
    295             return new WP_Error('unexpected', 'An unexpected error occurred!');
    296         }
     261        if ( ! wp_verify_nonce( $_POST['s8-clr-login-nonce'], plugin_dir_path( S8_LOGIN_FILE ) ) )
     262            die( 'An attempt to bypass security checks was detected! Please go back to the login form, refresh the page, and try again.' );
     263        $credentials = array(
     264            'user_login' => sanitize_user( $_POST['username'] ),
     265            'user_password' => $_POST['pwd'],
     266            'remember' => ( empty( $_POST['remember'] ) ? false : true )
     267        );
     268        $user = wp_signon( $credentials );
     269        return $user;
     270    }
     271
     272    /**
     273     * This handles the redirection of our users after login, this was split off from our login_user function
     274     * @param $user_login
     275     * @param $user
     276     * @since 0.8.5
     277     */
     278    function login_redirect( $user_login, $user ) {
     279        // Check for custom redirect
     280        $redirects = get_option('s8_login_redirects');
     281        $role = $user->roles;
     282        // Grab the first user role
     283        if ( is_array( $role ) )
     284            $role = $role[0];
     285        // Setup our redirect URL
     286        if ( isset( $redirects[$role] ) ) {
     287            $url = $redirects[$role];
     288        } elseif ( $_POST['redirect'] != '' ) {
     289            $url = $_POST['redirect'];
     290        } else {
     291            $url = home_url('/');
     292        }
     293        // Redirect and exit to avoid errors
     294        wp_redirect( $url, 302 );
     295        exit;
    297296    }
    298297
     
    302301     */
    303302    function no_wp_login() {
    304         if(defined('S8_LOGIN_INIT') && S8_LOGIN_INIT === true) return;
    305         $check = get_option('s8_allow_wp_register');
    306         if($check && $_REQUEST['action'] == 'register') return;
    307         if($_GET['no-redirect'] == 'true') {
    308             wp_enqueue_script('s8-login-failsafe', plugins_url('/js/s8-login-failsafe.js', S8_LOGIN_FILE), array('jquery'));
     303        // This does something important...
     304        if ( defined( 'S8_LOGIN_INIT' ) && S8_LOGIN_INIT === true )
    309305            return;
    310         }
    311         if($_GET['redirect_to'] != '') $url = $_GET['redirect_to'];
    312         else $url = false;
    313         if($_GET['action'] == 'logout')
    314             wp_redirect(s8_get_logout_url($url));
    315         elseif($_GET['action'] == 'register')
    316             wp_redirect(s8_get_register_url($url));
    317         else
    318             wp_redirect(s8_get_login_url($url));
     306        // See if we are trying to register and want to use the WP registration form
     307        $check = get_option( 's8_allow_wp_register' );
     308        if ( $check && $_REQUEST['action'] == 'register' )
     309            return;
     310        // Check if this is validation for a password protected post/page
     311        if ( $_GET['action'] == 'postpass' )
     312            return;
     313        // See if we are in no-redirect mode
     314        if ( $_GET['no-redirect'] == 'true' ) {
     315            wp_enqueue_script( 's8-login-failsafe', plugins_url( '/js/s8-login-failsafe.js', S8_LOGIN_FILE ), array( 'jquery' ) );
     316            return;
     317        }
     318        // Let's check for a redirect value
     319        if ( $_GET['redirect_to'] != '' ) {
     320            $url = $_GET['redirect_to'];
     321        } else {
     322            $url = false;
     323        }
     324        // Redirect away from the WP login page
     325        if ( $_GET['action'] == 'logout' ) {
     326            wp_redirect( s8_get_logout_url( $url ) );
     327        } elseif ( $_GET['action'] == 'register' ) {
     328            wp_redirect( s8_get_register_url( $url ) );
     329        } else {
     330            wp_redirect( s8_get_login_url( $url ) );
     331        }
    319332        exit;
    320333    }
Note: See TracChangeset for help on using the changeset viewer.