Theme My Login - Version 1.2.0

Version Description

Download this release

Release Info

Developer jfarthing84
Plugin Icon 128x128 Theme My Login
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.2 to 1.2.0

includes/admin-page.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( $_POST ) {
4
+ if ( !current_user_can('manage_options') )
5
+ die( __('Cheatin&#8217; huh?') );
6
+
7
+ check_admin_referer('tml-settings');
8
+
9
+ $this->SetOption('chk_uninstall', stripslashes($_POST['chk_uninstall']));
10
+ $this->SetOption('login_redirect', stripslashes($_POST['login_redirect']));
11
+ $this->SetOption('logout_redirect', stripslashes($_POST['logout_redirect']));
12
+ $this->SetOption('login_title', stripslashes($_POST['login_title']));
13
+ $this->SetOption('login_text', stripslashes($_POST['login_text']));
14
+ $this->SetOption('register_title', stripslashes($_POST['register_title']));
15
+ $this->SetOption('register_text', stripslashes($_POST['register_text']));
16
+ $this->SetOption('register_msg', stripslashes($_POST['register_msg']));
17
+ $this->SetOption('password_title', stripslashes($_POST['password_title']));
18
+ $this->SetOption('password_text', stripslashes($_POST['password_text']));
19
+ $this->SetOption('profile_title', stripslashes($_POST['profile_title']));
20
+ $this->SetOption('profile_text', stripslashes($_POST['profile_text']));
21
+ $this->SaveOptions();
22
+
23
+ $success = "<li>Settings updated successfully!</li>";
24
+ }
25
+ ?>
26
+
27
+ <div class="updated">
28
+ <p><?php _e('If you like this plugin, please help keep it up to date by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3836253">donating through PayPal</a>!'); ?></p>
29
+ </div>
30
+
31
+ <div class="wrap">
32
+ <?php if ( strlen($success) > 0 ) { ?>
33
+ <div id="message" class="updated fade">
34
+ <p><strong><?php _e("<ul>{$success}</ul>"); ?></strong></p>
35
+ </div>
36
+ <?php } ?>
37
+ <div id="icon-options-general" class="icon32"><br /></div>
38
+ <h2><?php _e('Theme My Login Settings'); ?></h2>
39
+
40
+ <form action="" method="post" id="tml-settings">
41
+ <?php if ( function_exists('wp_nonce_field') ) wp_nonce_field('tml-settings'); ?>
42
+ <table class="form-table">
43
+ <tr valign="top">
44
+ <th scope="row"><label for="chk_uninstall"><?php _e('Complete Uninstall?'); ?></label></th>
45
+ <td>
46
+ <input name="chk_uninstall" type="checkbox" id="chk_uninstall" value="1" <?php if ($this->GetOption('chk_uninstall')) { echo 'checked="checked"'; } ?> />
47
+ <span class="setting-description"><?php _e('Check here and then disable plugin to completely uninstall.'); ?></span>
48
+ </td>
49
+ </tr>
50
+ </table>
51
+ <h3><?php _e('Redirection Settings'); ?></h3>
52
+ <table class="form-table">
53
+ <tr valign="top">
54
+ <th scope="row"><label for="login_redirect"><?php _e('Redirect on Login'); ?></label></th>
55
+ <td>
56
+ <input name="login_redirect" type="text" id="login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('login_redirect') ) ); ?>" class="regular-text" />
57
+ <span class="setting-description"><?php _e('Defaults to <code>wp-admin/</code>.'); ?></span>
58
+ </td>
59
+ </tr>
60
+ <tr valign="top">
61
+ <th scope="row"><label for="logout_redirect"><?php _e('Redirect on Logout'); ?></label></th>
62
+ <td>
63
+ <input name="logout_redirect" type="text" id="logout_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('logout_redirect') ) ); ?>" class="regular-text" />
64
+ <span class="setting-description"><?php _e('Defaults to <code>wp-login.php?loggedout=true</code>.'); ?></span>
65
+ </td>
66
+ </tr>
67
+ </table>
68
+
69
+ <h3><?php _e('Template Settings'); ?></h3>
70
+ <table class="form-table">
71
+ <tr valign="top">
72
+ <th scope="row"><label for="register_title"><?php _e('Register Page Title'); ?></label></th>
73
+ <td>
74
+ <input name="register_title" type="text" id="register_title" value="<?php echo( htmlspecialchars ( $this->GetOption('register_title') ) ); ?>" class="regular-text" />
75
+ <span class="setting-description">You can use %blogname% for your blog name. Defaults to 'Register &rsaquo;'</span>
76
+ </td>
77
+ </tr>
78
+ <tr valign="top">
79
+ <th scope="row"><label for="register_text"><?php _e('Register Text'); ?></label></th>
80
+ <td>
81
+ <input name="register_text" type="text" id="register_text" value="<?php echo( htmlspecialchars ( $this->GetOption('register_text') ) ); ?>" class="regular-text" />
82
+ <span class="setting-description"><?php _e('This will appear above the registration form.'); ?></span>
83
+ </td>
84
+ </tr>
85
+ <tr valign="top">
86
+ <th scope="row"><label for="register_msg"><?php _e('Register Message'); ?></label></th>
87
+ <td>
88
+ <input name="register_msg" type="text" id="register_msg" value="<?php echo( htmlspecialchars ( $this->GetOption('register_msg') ) ); ?>" class="regular-text" />
89
+ <span class="setting-description"><?php _e('This will appear below the registration form.'); ?></span>
90
+ </td>
91
+ </tr>
92
+ <tr valign="top">
93
+ <th scope="row"><label for="login_title"><?php _e('Login Page Title'); ?></label></th>
94
+ <td>
95
+ <input name="login_title" type="text" id="login_title" value="<?php echo( htmlspecialchars ( $this->GetOption('login_title') ) ); ?>" class="regular-text" />
96
+ <span class="setting-description">You can use %blogname% for your blog name. Defaults to 'Log In &rsaquo;'</span>
97
+ </td>
98
+ </tr>
99
+ <tr valign="top">
100
+ <th scope="row"><label for="login_text"><?php _e('Login Text'); ?></label></th>
101
+ <td>
102
+ <input name="login_text" type="text" id="login_text" value="<?php echo( htmlspecialchars ( $this->GetOption('login_text') ) ); ?>" class="regular-text" />
103
+ <span class="setting-description"><?php _e('This will appear above the login form.'); ?></span>
104
+ </td>
105
+ </tr>
106
+ <tr valign="top">
107
+ <th scope="row"><label for="password_title"><?php _e('Lost Password Page Title'); ?></label></th>
108
+ <td>
109
+ <input name="password_title" type="text" id="password_title" value="<?php echo( htmlspecialchars ( $this->GetOption('password_title') ) ); ?>" class="regular-text" />
110
+ <span class="setting-description">You can use %blogname% for your blog name. Defaults to 'Lost Password &rsaquo;'</span>
111
+ </td>
112
+ </tr>
113
+ <tr valign="top">
114
+ <th scope="row"><label for="password_text"><?php _e('Lost Password Text'); ?></label></th>
115
+ <td>
116
+ <input name="password_text" type="text" id="password_text" value="<?php echo( htmlspecialchars ( $this->GetOption('password_text') ) ); ?>" class="regular-text" />
117
+ <span class="setting-description"><?php _e('This will appear above the lost password form.'); ?></span>
118
+ </td>
119
+ </tr>
120
+ <tr valign="top">
121
+ <th scope="row"><label for="profile_title"><?php _e('Profile Page Title'); ?></label></th>
122
+ <td>
123
+ <input name="profile_title" type="text" id="profile_title" value="<?php echo( htmlspecialchars ( $this->GetOption('profile_title') ) ); ?>" class="regular-text" />
124
+ <span class="setting-description">You can use %blogname% for your blog name. Defaults to 'Profile &rsaquo;'</span>
125
+ </td>
126
+ </tr>
127
+ <tr valign="top">
128
+ <th scope="row"><label for="profile_text"><?php _e('Profile Text'); ?></label></th>
129
+ <td>
130
+ <input name="profile_text" type="text" id="profile_text" value="<?php echo( htmlspecialchars ( $this->GetOption('profile_text') ) ); ?>" class="regular-text" />
131
+ <span class="setting-description"><?php _e('This will appear above the users profile.'); ?></span>
132
+ </td>
133
+ </tr>
134
+ </table>
135
+ <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />
136
+ </form>
137
+ </div>
includes/compat.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !function_exists('is_ssl') ) :
3
+ function is_ssl() {
4
+ if ( isset($_SERVER['HTTPS']) ) {
5
+ if ( 'on' == strtolower($_SERVER['HTTPS']) )
6
+ return true;
7
+ if ( '1' == $_SERVER['HTTPS'] )
8
+ return true;
9
+ } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
10
+ return true;
11
+ }
12
+ return false;
13
+ }
14
+ endif;
15
+
16
+ if ( !function_exists('site_url') ) :
17
+ function site_url($path = '', $scheme = null) {
18
+ // should the list of allowed schemes be maintained elsewhere?
19
+ $orig_scheme = $scheme;
20
+ if ( !in_array($scheme, array('http', 'https')) ) {
21
+ if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
22
+ $scheme = 'https';
23
+ elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
24
+ $scheme = 'https';
25
+ elseif ( ('admin' == $scheme) && force_ssl_admin() )
26
+ $scheme = 'https';
27
+ else
28
+ $scheme = ( is_ssl() ? 'https' : 'http' );
29
+ }
30
+
31
+ $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
32
+
33
+ if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
34
+ $url .= '/' . ltrim($path, '/');
35
+
36
+ return apply_filters('site_url', $url, $path, $orig_scheme);
37
+ }
38
+ endif;
39
+
40
+ if ( !function_exists('admin_url') ) :
41
+ function admin_url($path = '') {
42
+ $url = site_url('wp-admin/', 'admin');
43
+
44
+ if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
45
+ $url .= ltrim($path, '/');
46
+
47
+ return $url;
48
+ }
49
+ endif;
50
+
51
+ if ( !function_exists('force_ssl_login') ) :
52
+ function force_ssl_login($force = '') {
53
+ static $forced;
54
+
55
+ if ( '' != $force ) {
56
+ $old_forced = $forced;
57
+ $forced = $force;
58
+ return $old_forced;
59
+ }
60
+
61
+ return $forced;
62
+ }
63
+ endif;
64
+
65
+ if ( !function_exists('force_ssl_admin') ) :
66
+ function force_ssl_admin($force = '') {
67
+ static $forced;
68
+
69
+ if ( '' != $force ) {
70
+ $old_forced = $forced;
71
+ $forced = $force;
72
+ return $old_forced;
73
+ }
74
+
75
+ return $forced;
76
+ }
77
+ endif;
78
+
79
+ if (!function_exists('retrieve_password')) :
80
+ function retrieve_password() {
81
+ global $wpdb;
82
+
83
+ $errors = new WP_Error();
84
+
85
+ if ( empty( $_POST['user_login'] ) && empty( $_POST['user_email'] ) )
86
+ $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
87
+
88
+ if ( strpos($_POST['user_login'], '@') ) {
89
+ $user_data = get_user_by_email(trim($_POST['user_login']));
90
+ if ( empty($user_data) )
91
+ $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
92
+ } else {
93
+ $login = trim($_POST['user_login']);
94
+ $user_data = get_userdatabylogin($login);
95
+ }
96
+
97
+ do_action('lostpassword_post');
98
+
99
+ if ( $errors->get_error_code() )
100
+ return $errors;
101
+
102
+ if ( !$user_data ) {
103
+ $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
104
+ return $errors;
105
+ }
106
+
107
+ // redefining user_login ensures we return the right case in the email
108
+ $user_login = $user_data->user_login;
109
+ $user_email = $user_data->user_email;
110
+
111
+ do_action('retreive_password', $user_login); // Misspelled and deprecated
112
+ do_action('retrieve_password', $user_login);
113
+
114
+ $allow = apply_filters('allow_password_reset', true, $user_data->ID);
115
+
116
+ if ( ! $allow )
117
+ return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
118
+ else if ( is_wp_error($allow) )
119
+ return $allow;
120
+
121
+ $key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
122
+ if ( empty($key) ) {
123
+ // Generate something random for a key...
124
+ $key = wp_generate_password(20, false);
125
+ do_action('retrieve_password_key', $user_login, $key);
126
+ // Now insert the new md5 key into the db
127
+ $wpdb->query($wpdb->prepare("UPDATE $wpdb->users SET user_activation_key = %s WHERE user_login = %s", $key, $user_login));
128
+ }
129
+ $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
130
+ $message .= get_option('siteurl') . "\r\n\r\n";
131
+ $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
132
+ $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
133
+ $message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
134
+
135
+ if ( !wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message) )
136
+ die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
137
+
138
+ return true;
139
+ }
140
+ endif;
141
+
142
+ if (!function_exists('register_new_user')) :
143
+ function register_new_user($user_login, $user_email) {
144
+ $errors = new WP_Error();
145
+
146
+ $user_login = sanitize_user( $user_login );
147
+ $user_email = apply_filters( 'user_registration_email', $user_email );
148
+
149
+ // Check the username
150
+ if ( $user_login == '' )
151
+ $errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
152
+ elseif ( !validate_username( $user_login ) ) {
153
+ $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.'));
154
+ $user_login = '';
155
+ } elseif ( username_exists( $user_login ) )
156
+ $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
157
+
158
+ // Check the e-mail address
159
+ if ($user_email == '') {
160
+ $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
161
+ } elseif ( !is_email( $user_email ) ) {
162
+ $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.'));
163
+ $user_email = '';
164
+ } elseif ( email_exists( $user_email ) )
165
+ $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
166
+
167
+ do_action('register_post', $user_login, $user_email, $errors);
168
+
169
+ $errors = apply_filters( 'registration_errors', $errors );
170
+
171
+ if ( $errors->get_error_code() )
172
+ return $errors;
173
+
174
+ $user_pass = wp_generate_password();
175
+ $user_id = wp_create_user( $user_login, $user_pass, $user_email );
176
+ if ( !$user_id ) {
177
+ $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
178
+ return $errors;
179
+ }
180
+
181
+ wp_new_user_notification($user_id, $user_pass);
182
+
183
+ return $user_id;
184
+ }
185
+ endif;
186
+
187
+ if (!function_exists('wp_reset_vars')) :
188
+ function wp_reset_vars( $vars ) {
189
+ for ( $i=0; $i<count( $vars ); $i += 1 ) {
190
+ $var = $vars[$i];
191
+ global $$var;
192
+
193
+ if (!isset( $$var ) ) {
194
+ if ( empty( $_POST["$var"] ) ) {
195
+ if ( empty( $_GET["$var"] ) )
196
+ $$var = '';
197
+ else
198
+ $$var = $_GET["$var"];
199
+ } else {
200
+ $$var = $_POST["$var"];
201
+ }
202
+ }
203
+ }
204
+ }
205
+ endif;
206
+
207
+ if (!function_exists('get_user_to_edit')) :
208
+ function get_user_to_edit( $user_id ) {
209
+ $user = new WP_User( $user_id );
210
+ $user->user_login = attribute_escape($user->user_login);
211
+ $user->user_email = attribute_escape($user->user_email);
212
+ $user->user_url = clean_url($user->user_url);
213
+ $user->first_name = attribute_escape($user->first_name);
214
+ $user->last_name = attribute_escape($user->last_name);
215
+ $user->display_name = attribute_escape($user->display_name);
216
+ $user->nickname = attribute_escape($user->nickname);
217
+ $user->aim = isset( $user->aim ) && !empty( $user->aim ) ? attribute_escape($user->aim) : '';
218
+ $user->yim = isset( $user->yim ) && !empty( $user->yim ) ? attribute_escape($user->yim) : '';
219
+ $user->jabber = isset( $user->jabber ) && !empty( $user->jabber ) ? attribute_escape($user->jabber) : '';
220
+ $user->description = isset( $user->description ) && !empty( $user->description ) ? wp_specialchars($user->description) : '';
221
+
222
+ return $user;
223
+ }
224
+ endif;
225
+ ?>
includes/login.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( isset( $_REQUEST['redirect_to'] ) ) {
4
+ $redirect_to = $_REQUEST['redirect_to'];
5
+ // Redirect to https if user wants ssl
6
+ if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
7
+ $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
8
+ } else {
9
+ $redirect_to = $this->GetOption('login_redirect');
10
+ }
11
+
12
+ $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
13
+
14
+ // Clear errors if loggedout is set.
15
+ if ( !empty($_GET['loggedout']) )
16
+ $errors = new WP_Error();
17
+
18
+ // If cookies are disabled we can't log in even with a valid user+pass
19
+ if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
20
+ $this->errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
21
+
22
+ // Some parts of this script use the main login form to display a message
23
+ if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) $this->errors->add('loggedout', __('You are now logged out.'), 'message');
24
+ elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $this->errors->add('registerdisabled', __('User registration is currently not allowed.'));
25
+ elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $this->errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
26
+ elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $this->errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
27
+ elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $this->errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
28
+
29
+ $this->DoHeader('', $this->errors);
30
+
31
+ if ( isset($_POST['log']) )
32
+ $user_login = ( 'incorrect_password' == $this->errors->get_error_code() || 'empty_password' == $this->errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : '';
33
+ ?>
34
+
35
+ <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
36
+ <form name="loginform" id="loginform" action="<?php echo $this->QueryURL(); ?>action=login" method="post">
37
+ <p>
38
+ <label><?php _e('Username') ?><br />
39
+ <input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="20" tabindex="10" /></label>
40
+ </p>
41
+ <p>
42
+ <label><?php _e('Password') ?><br />
43
+ <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
44
+ </p>
45
+ <?php do_action('login_form'); ?>
46
+ <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me'); ?></label></p>
47
+ <p class="submit">
48
+ <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
49
+ <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
50
+ <input type="hidden" name="testcookie" value="1" />
51
+ </p>
52
+ </form>
53
+ <?php endif; ?>
54
+
55
+ <ul class="nav">
56
+ <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
57
+ <?php elseif (get_option('users_can_register')) : ?>
58
+ <li><a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a></li>
59
+ <?php endif; ?>
60
+ <li><a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
61
+ </ul>
62
+
63
+ </div>
includes/lost-password.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $this->errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
4
+
5
+ do_action('lost_password');
6
+ $this->DoHeader('<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $this->errors);
7
+
8
+ $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
9
+
10
+ ?>
11
+
12
+ <form name="lostpasswordform" id="lostpasswordform" action="" method="post">
13
+ <p>
14
+ <label><?php _e('Username or E-mail:') ?><br />
15
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
16
+ </p>
17
+ <?php do_action('lostpassword_form'); ?>
18
+ <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" tabindex="100" /></p>
19
+ </form>
20
+
21
+ <ul class="nav">
22
+ <li><a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a></li>
23
+ <?php if (get_option('users_can_register')) : ?>
24
+ <li><a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></li>
25
+ <?php endif; ?>
26
+ </ul>
27
+
28
+ </div>
includes/profile.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require 'compat.php';
4
+
5
+ if ( !$user_id ) {
6
+ $current_user = wp_get_current_user();
7
+ $user_id = $current_user->ID;
8
+ }
9
+
10
+ if ($current_user->has_cap('edit_posts') === false) {
11
+ $is_profile_page = true;
12
+
13
+ wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
14
+ $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
15
+ $user_id = (int) $user_id;
16
+
17
+ $profileuser = get_user_to_edit($user_id);
18
+ if ( !current_user_can('edit_user', $user_id) )
19
+ wp_die(__('You do not have permission to edit this user.'));
20
+
21
+ $this->DoHeader('', $this->errors);
22
+ if ($_GET['updated'] == true) {
23
+ echo '<p class="message">Your profile has been updated.</p>';
24
+ }
25
+ ?>
26
+
27
+ <form name="profile" id="your-profile" action="<?php echo $this->QueryURL(); ?>show=profile" method="post">
28
+ <?php wp_nonce_field('update-user_' . $user_id) ?>
29
+ <?php if ( $wp_http_referer ) : ?>
30
+ <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
31
+ <?php endif; ?>
32
+ <p>
33
+ <input type="hidden" name="from" value="profile" />
34
+ <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
35
+ </p>
36
+
37
+ <h3><?php _e('Name') ?></h3>
38
+
39
+ <table class="form-table">
40
+ <tr>
41
+ <th><label for="user_login"><?php _e('Username'); ?></label></th>
42
+ <td><input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> <?php _e('Your username cannot be changed'); ?></td>
43
+ </tr>
44
+ <tr>
45
+ <th><label for="first_name"><?php _e('First name') ?></label></th>
46
+ <td><input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></td>
47
+ </tr>
48
+ <tr>
49
+ <th><label for="last_name"><?php _e('Last name') ?></label></th>
50
+ <td><input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></td>
51
+ </tr>
52
+ <tr>
53
+ <th><label for="nickname"><?php _e('Nickname') ?></label></th>
54
+ <td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></td>
55
+ </tr>
56
+ <tr>
57
+ <th><label for="display_name"><?php _e('Display name publicly&nbsp;as') ?></label></th>
58
+ <td>
59
+ <select name="display_name" id="display_name">
60
+ <?php
61
+ $public_display = array();
62
+ $public_display['display_displayname'] = $profileuser->display_name;
63
+ $public_display['display_nickname'] = $profileuser->nickname;
64
+ $public_display['display_username'] = $profileuser->user_login;
65
+ $public_display['display_firstname'] = $profileuser->first_name;
66
+ $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
67
+ $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
68
+ $public_display = array_unique(array_filter(array_map('trim', $public_display)));
69
+ foreach($public_display as $id => $item) {
70
+ ?>
71
+ <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
72
+ <?php
73
+ }
74
+ ?>
75
+ </select>
76
+ </td>
77
+ </tr>
78
+ </table>
79
+
80
+ <h3><?php _e('Contact Info') ?></h3>
81
+
82
+ <table class="form-table">
83
+ <tr>
84
+ <th><label for="email"><?php _e('E-mail') ?></label></th>
85
+ <td><input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /> <?php _e('Required'); ?></td>
86
+ </tr>
87
+
88
+ <tr>
89
+ <th><label for="url"><?php _e('Website') ?></label></th>
90
+ <td><input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" /></td>
91
+ </tr>
92
+
93
+ <tr>
94
+ <th><label for="aim"><?php _e('AIM') ?></label></th>
95
+ <td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" /></td>
96
+ </tr>
97
+
98
+ <tr>
99
+ <th><label for="yim"><?php _e('Yahoo IM') ?></label></th>
100
+ <td><input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" /></td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <th><label for="jabber"><?php _e('Jabber / Google Talk') ?></label></th>
105
+ <td><input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></td>
106
+ </tr>
107
+ </table>
108
+
109
+ <h3><?php _e('About Yourself'); ?></h3>
110
+
111
+ <table class="form-table">
112
+ <tr>
113
+ <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
114
+ <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea><br /><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?><br/><br/></td>
115
+ </tr>
116
+
117
+ <?php
118
+ $show_password_fields = apply_filters('show_password_fields', true);
119
+ if ( $show_password_fields ) :
120
+ ?>
121
+ <tr>
122
+ <th><label for="pass1"><?php _e('New Password'); ?></label></th>
123
+ <td>
124
+ <input type="password" name="pass1" id="pass1" size="16" value="" /><br/><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
125
+ <input type="password" name="pass2" id="pass2" size="16" value="" /><br/><?php _e("Type your new password again."); ?><br />
126
+ </td>
127
+ </tr>
128
+ <?php endif; ?>
129
+ </table>
130
+
131
+ <?php
132
+ do_action('profile_personal_options');
133
+ do_action('show_user_profile');
134
+ ?>
135
+
136
+ <?php if (count($profileuser->caps) > count($profileuser->roles)): ?>
137
+ <br class="clear" />
138
+ <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
139
+ <tr>
140
+ <th scope="row"><?php _e('Additional Capabilities') ?></th>
141
+ <td><?php
142
+ $output = '';
143
+ foreach($profileuser->caps as $cap => $value) {
144
+ if(!$wp_roles->is_role($cap)) {
145
+ if($output != '') $output .= ', ';
146
+ $output .= $value ? $cap : "Denied: {$cap}";
147
+ }
148
+ }
149
+ echo $output;
150
+ ?></td>
151
+ </tr>
152
+ </table>
153
+ <?php endif; ?>
154
+
155
+ <p class="submit">
156
+ <input type="hidden" name="action" value="update" />
157
+ <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
158
+ <input type="submit" id="submit" value="<?php _e('Update Profile') ?>" name="submit" />
159
+ </p>
160
+ </form>
161
+ </div>
162
+ <?php
163
+ }
164
+
165
+ ?>
includes/register.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ($http_post) {
4
+ $user_login = $_POST['user_login'];
5
+ $user_email = $_POST['user_email'];
6
+ }
7
+
8
+ $this->DoHeader('', $this->errors);
9
+ ?>
10
+
11
+ <form name="registerform" id="registerform" action="<?php echo get_permalink($this->GetOption('page_id')); ?>?action=register" method="post">
12
+ <p>
13
+ <label><?php _e('Username') ?><br />
14
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
15
+ </p>
16
+ <p>
17
+ <label><?php _e('E-mail') ?><br />
18
+ <input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
19
+ </p>
20
+ <?php do_action('register_form'); ?>
21
+ <p id="reg_passmail"><?php _e($this->GetOption('register_msg')) ?></p>
22
+ <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register'); ?>" tabindex="100" /></p>
23
+ </form>
24
+
25
+ <ul class="nav">
26
+ <li><a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a></li>
27
+ <li><a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
28
+ </ul>
29
+
30
+ </div>
readme.txt CHANGED
@@ -3,15 +3,15 @@ Contributors: jfarthing84
3
  Donate link: http://webdesign.jaedub.com
4
  Tags: wordpress, login, register, theme, form, james kelly
5
  Requires at least: 2.5
6
- Tested up to: 2.5
7
- Stable tag: 1.1.2
8
 
9
  This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
10
 
11
 
12
  == Description ==
13
 
14
- This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website. It replaces the wp-login.php and profile.php pages with functions that render your theme settings as specified in your WordPress administration panel under Settings->Theme My Login.
15
 
16
 
17
  == Installation ==
@@ -22,23 +22,23 @@ Upload the Theme My Login plugin to your 'wp-content/plugins' directory and acti
22
 
23
  2. Redirect on Logout - You can change this to any location you would like the user to be redirected to upon logout. This defaults to 'wp-login.php?loggedout=true'.
24
 
25
- 3. Register Text - You can change this to whatever text you want to appear above your registration form. This defaults to 'Register'.
26
 
27
- 4. Register Message - You can change this to whatever you want to appear below your registration form. This defaults to 'A password will be e-mailed to you.'
28
 
29
- 5. Login Text - You can change this to whatever text you want to appear above your login form. This defaults to 'Log In'.
30
 
31
- 6. Forgot Password Text - You can change this to whatever text you want to appear above your forgot password form. This defaults to 'Forgot Password'.
32
 
33
- 7. Profile Text - You can change this to whatever text you want to appear above the user profile form. This defaults to 'Your Profile'.
34
 
35
- 8. Template Header Files - Enter each header file used in your template, one per line. Typically, this is only header.php, but you can figure this out by clicking Appearance->Editor->Main Index Template. If the only function call you see is get_header() before the HTML then it's likely this is the only file you need to enter.
36
 
37
- 9. Template HTML After Header - Enter the HTML that appears between the get_header() function and the page code. You can probably figure this out by clicking Appearance->Editor->Main Index Template. The HTML you need to copy is everything between the last ?> in the top of the file and the line that looks something like this: <?php endif; ?> and the line that may look like this: <?php get_sidebar(); ?>. Keep in mind that if you are using a template that doesn't fit the typical scheme, you will need to experiment a bit to get this right.
38
 
39
- 10. Template HTML Before Footer - Enter the HTML that appears between the page code and the get_sidebar()/get_footer() functions. You can probably figure this out by clicking Appearance->Editor->Main Index Template. The HTML you need to copy is everything between the last ?> in the top of the file and the line that looks something like this: <?php if (have_posts()) : ?>. Keep in mind that if you are using a template that doesn't fit the typical scheme, you will need to experiment a bit to get this right.
40
 
41
- 11. Template Footer Files - Enter each footer file used in your template, one per line. Typically this is sidebar.php and footer.php. You can figure this out by clicking Appearance->Editor->Main Index Template. If you see the function calls get_sidebar() and get_footer() then you should be able to leave the defaults alone.
42
 
43
  Now you can save your changes and go test out your new themed login and registration pages. That's all!
44
 
@@ -49,4 +49,6 @@ Now you can save your changes and go test out your new themed login and registra
49
  * 1.0.1 - 2009-03-14 - Made backwards compatible to WordPress 2.5+
50
  * 1.1.0 - 2009-03-14 - Added custom profile to completely hide the back-end from subscribers
51
  * 1.1.1 - 2009-03-16 - Prepared plugin for internationalization and fixed a PHP version bug
52
- * 1.1.2 - 2009-03-20 - Updated to allow customization of text below registration form
 
 
3
  Donate link: http://webdesign.jaedub.com
4
  Tags: wordpress, login, register, theme, form, james kelly
5
  Requires at least: 2.5
6
+ Tested up to: 2.7.1
7
+ Stable tag: 2.0
8
 
9
  This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
10
 
11
 
12
  == Description ==
13
 
14
+ This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website. It replaces the wp-login.php and profile.php by using a page template from your theme.
15
 
16
 
17
  == Installation ==
22
 
23
  2. Redirect on Logout - You can change this to any location you would like the user to be redirected to upon logout. This defaults to 'wp-login.php?loggedout=true'.
24
 
25
+ 3. Register Page Title - You can change this to whatever title you want for the registration page. You can use %blogname% for your blog name. This defaults to 'Register &rsaquo;'.
26
 
27
+ 4. Register Text - You can change this to whatever text you want to appear above your registration form. This defaults to 'Register'.
28
 
29
+ 5. Register Message - You can change this to whatever you want to appear below your registration form. This defaults to 'A password will be e-mailed to you.'
30
 
31
+ 6. Login Page Title - You can change this to whatever title you want to for the login page. You can use %blogname% for your blog name. This defaults to 'Log In &rsaquo;'.
32
 
33
+ 7. Login Text - You can change this to whatever text you want to appear above your login form. This defaults to 'Log In'.
34
 
35
+ 8. Lost Password Page Title - You can change this to whatever title you want for the lost password page. You can use %blogname% for your blog name. This defaults to 'Lost Password &rsaquo;'.
36
 
37
+ 9. Lost Password Text - You can change this to whatever text you want to appear above your lost password form. This defaults to 'Lost Password'.
38
 
39
+ 10. Profile Page Title - You can change this to whatever title you want for the subscriber profile page. You can use %blogname% for your blog name. This defaults to 'Profile &rsqauo;'.
40
 
41
+ 11. Profile Text - You can change this to whatever text you want to appear above the user profile form. This defaults to 'Your Profile'.
42
 
43
  Now you can save your changes and go test out your new themed login and registration pages. That's all!
44
 
49
  * 1.0.1 - 2009-03-14 - Made backwards compatible to WordPress 2.5+
50
  * 1.1.0 - 2009-03-14 - Added custom profile to completely hide the back-end from subscribers
51
  * 1.1.1 - 2009-03-16 - Prepared plugin for internationalization and fixed a PHP version bug
52
+ * 1.1.2 - 2009-03-20 - Updated to allow customization of text below registration form
53
+ * 1.2.0 - 2009-03-26 - Added capability to customize page titles for all pages affected by plugin
54
+ * 2.0.0 - 2009-03-27 - Completely rewrote plugin to use page template, no more specifying template files & HTML
theme-my-login.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://webdesign.jaedub.com/wordpress-plugins/theme-my-login-plugin
5
  Description: Themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
6
- Version: 1.1.2
7
  Author: Jae Dub
8
  Author URI: http://webdesign.jaedub.com
9
 
@@ -19,12 +19,18 @@ Version History
19
  Prepared plugin for internationalization and fixed a PHP version bug
20
  1.1.2 - 2009-03-20
21
  Updated to allow customization of text below registration form
 
 
 
 
22
  */
23
 
24
  if (!class_exists('ThemeMyLogin')) {
25
  class ThemeMyLogin {
26
-
27
  var $options = array();
 
 
28
 
29
  function ThemeMyLogin() {
30
  $this->__construct();
@@ -33,39 +39,68 @@ if (!class_exists('ThemeMyLogin')) {
33
  function __construct() {
34
  register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
35
  register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
36
-
37
  add_action('init', array(&$this, 'Init'));
38
  add_action('admin_menu', array(&$this, 'AddAdminPage'));
39
 
40
- if ( !isset($_POST['from']) && $_POST['from'] != 'profile' )
41
- add_action('load-profile.php', array(&$this, 'DoProfile'));
 
 
42
 
43
- $this->LoadOptions();
 
 
 
 
 
 
44
  }
45
-
46
- function Activate() {
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
-
50
  function Deactivate() {
51
- delete_option('tml_options');
 
 
 
52
  }
53
-
54
  # Sets up default options
55
  function InitOptions() {
56
- $this->options['tml_version'] ='1.0';
57
- $this->options['tml_uninstall'] = 0;
58
- $this->options['tml_login_redirect'] = 'wp-admin/';
59
- $this->options['tml_logout_redirect'] = 'wp-login.php?loggedout=true';
60
- $this->options['tml_header_files'] = array('header.php');
61
- $this->options['tml_header_html'] = ' <div id="content" class="narrowcolumn">' . "\n";
62
- $this->options['tml_footer_files'] = array('sidebar.php', 'footer.php');
63
- $this->options['tml_footer_html'] = ' </div>' . "\n";
64
- $this->options['tml_login_text'] = 'Log In';
65
- $this->options['tml_register_text'] = 'Register';
66
- $this->options['tml_register_msg'] = 'A password will be e-mailed to you.';
67
- $this->options['tml_password_text'] = 'Reset Password';
68
- $this->options['tml_profile_text'] = 'Your Profile';
 
69
  }
70
 
71
  # Loads options from database
@@ -73,17 +108,16 @@ if (!class_exists('ThemeMyLogin')) {
73
 
74
  $this->InitOptions();
75
 
76
- $storedoptions = get_option( 'tml_options' );
77
  if ( $storedoptions && is_array( $storedoptions ) ) {
78
  foreach ( $storedoptions as $key => $value ) {
79
  $this->options[$key] = $value;
80
  }
81
- } else update_option( 'tml_options', $this->options );
82
  }
83
 
84
  # Returns option value for given key
85
  function GetOption( $key ) {
86
- $key = "tml_" . $key;
87
  if ( array_key_exists( $key, $this->options ) ) {
88
  return $this->options[$key];
89
  } else return null;
@@ -91,17 +125,15 @@ if (!class_exists('ThemeMyLogin')) {
91
 
92
  # Sets the speficied option key to a new value
93
  function SetOption( $key, $value ) {
94
- if ( strstr( $key, 'tml_' )!== 0 ) $key = 'tml_' . $key;
95
-
96
  $this->options[$key] = $value;
97
  }
98
 
99
  # Saves the options to the database
100
  function SaveOptions() {
101
- $oldvalue = get_option( 'tml_options' );
102
  if( $oldvalue == $this->options ) {
103
  return true;
104
- } else return update_option( 'tml_options', $this->options );
105
  }
106
 
107
  function AddAdminPage(){
@@ -109,227 +141,65 @@ if (!class_exists('ThemeMyLogin')) {
109
  }
110
 
111
  function AdminPage(){
112
- if ( $_POST ) {
113
- if ( !current_user_can('manage_options') )
114
- die( __('Cheatin&#8217; huh?') );
 
 
115
 
116
- check_admin_referer('tml-settings');
117
-
118
- $error = "";
119
- $header_files = trim(str_replace("\r\n", "\n", stripslashes($_POST['header_files'])));
120
- $header_files = explode("\n", $header_files);
121
- foreach((array)$header_files as $header_file) {
122
- if ( !file_exists(TEMPLATEPATH . '/' . $header_file) ) {
123
- $error .= "<li>The header file {$header_file} doesn't exist in your theme (template) directory, please verify the name and try again.</li>";
124
- }
125
- }
126
- if ( empty($error) )
127
- $this->SetOption('header_files', $header_files);
128
-
129
- $footer_files = trim(str_replace("\r\n", "\n", stripslashes($_POST['footer_files'])));
130
- $footer_files = explode("\n", $footer_files);
131
- foreach((array)$footer_files as $footer_file) {
132
- if ( !file_exists(TEMPLATEPATH . '/' . $footer_file) ) {
133
- $error .= "<li>The footer file {$footer_file} doesn't exist in your theme (template) directory, please verify the name and try again.</li>";
134
- }
135
- }
136
- if ( empty($error) ) {
137
- $this->SetOption('footer_files', $footer_files);
138
- $success = "<li>Custom login and registration form options updated successfully!</li>";
139
- }
140
-
141
- $this->SetOption('login_text', stripslashes($_POST['login_text']));
142
- $this->SetOption('register_text', stripslashes($_POST['register_text']));
143
- $this->SetOption('register_msg', stripslashes($_POST['register_msg']));
144
- $this->SetOption('password_text', stripslashes($_POST['password_text']));
145
- $this->SetOption('profile_text', stripslashes($_POST['profile_text']));
146
- $this->SetOption('login_redirect', stripslashes($_POST['login_redirect']));
147
- $this->SetOption('logout_redirect', stripslashes($_POST['logout_redirect']));
148
- $this->SetOption('header_html', stripslashes($_POST['header_html']));
149
- $this->SetOption('footer_html', stripslashes($_POST['footer_html']));
150
- $this->SaveOptions();
151
-
152
- $success = "<li>Settings updated successfully!</li>";
153
-
154
- } //end if
155
 
156
- ?>
157
- <div class="updated">
158
- <p><?php _e('If you like this plugin, please help keep it up to date by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3836253">donating through PayPal</a>!'); ?></p>
159
- </div>
160
- <div class="wrap">
161
- <?php if ( strlen($success) > 0 ) { ?>
162
- <div id="message" class="updated fade">
163
- <p><strong><?php _e("<ul>{$success}</ul>"); ?></strong></p>
164
- </div>
165
- <?php } ?>
166
- <div id="icon-options-general" class="icon32"><br /></div>
167
- <h2><?php _e('Theme My Login Settings'); ?></h2>
168
-
169
- <form action="" method="post" id="tml-settings">
170
- <?php if ( function_exists('wp_nonce_field') ) wp_nonce_field('tml-settings'); ?>
171
- <h3><?php _e('Redirection Settings'); ?></h3>
172
- <table class="form-table">
173
- <tr valign="top">
174
- <th scope="row"><label for="login_redirect"><?php _e('Redirect on Login'); ?></label></th>
175
- <td>
176
- <input name="login_redirect" type="text" id="login_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('login_redirect') ) ); ?>" class="regular-text" />
177
- <span class="setting-description"><?php _e('Defaults to <code>wp-admin/</code>.'); ?></span>
178
- </td>
179
- </tr>
180
- <tr valign="top">
181
- <th scope="row"><label for="logout_redirect"><?php _e('Redirect on Logout'); ?></label></th>
182
- <td>
183
- <input name="logout_redirect" type="text" id="logout_redirect" value="<?php echo( htmlspecialchars ( $this->GetOption('logout_redirect') ) ); ?>" class="regular-text" />
184
- <span class="setting-description"><?php _e('Defaults to <code>wp-login.php?loggedout=true</code>.'); ?></span>
185
- </td>
186
- </tr>
187
- </table>
188
-
189
- <h3><?php _e('Template Settings'); ?></h3>
190
- <table class="form-table">
191
- <tr valign="top">
192
- <th scope="row"><label for="register_text"><?php _e('Register Text'); ?></label></th>
193
- <td>
194
- <input name="register_text" type="text" id="register_text" value="<?php echo( htmlspecialchars ( $this->GetOption('register_text') ) ); ?>" class="regular-text" />
195
- <span class="setting-description"><?php _e('This will appear above the registration form.'); ?></span>
196
- </td>
197
- </tr>
198
- <tr valign="top">
199
- <th scope="row"><label for="register_msg"><?php _e('Register Message'); ?></label></th>
200
- <td>
201
- <input name="register_msg" type="text" id="register_msg" value="<?php echo( htmlspecialchars ( $this->GetOption('register_msg') ) ); ?>" class="regular-text" />
202
- <span class="setting-description"><?php _e('This will appear below the registration form.'); ?></span>
203
- </td>
204
- </tr>
205
- <tr valign="top">
206
- <th scope="row"><label for="login_text"><?php _e('Login Text'); ?></label></th>
207
- <td>
208
- <input name="login_text" type="text" id="login_text" value="<?php echo( htmlspecialchars ( $this->GetOption('login_text') ) ); ?>" class="regular-text" />
209
- <span class="setting-description"><?php _e('This will appear above the login form.'); ?></span>
210
- </td>
211
- </tr>
212
- <tr valign="top">
213
- <th scope="row"><label for="password_text"><?php _e('Forgot Password Text'); ?></label></th>
214
- <td>
215
- <input name="password_text" type="text" id="password_text" value="<?php echo( htmlspecialchars ( $this->GetOption('password_text') ) ); ?>" class="regular-text" />
216
- <span class="setting-description"><?php _e('This will appear above the forgot password form.'); ?></span>
217
- </td>
218
- </tr>
219
- <tr valign="top">
220
- <th scope="row"><label for="profile_text"><?php _e('Profile Text'); ?></label></th>
221
- <td>
222
- <input name="profile_text" type="text" id="profile_text" value="<?php echo( htmlspecialchars ( $this->GetOption('profile_text') ) ); ?>" class="regular-text" />
223
- <span class="setting-description"><?php _e('This will appear above the users profile.'); ?></span>
224
- </td>
225
- </tr>
226
- <tr valign="top">
227
- <th scope="row"><label for="login_redirect"><?php _e('Template Header Files'); ?></label></th>
228
- <td>
229
- <textarea name="header_files" id="header_files" rows="5" cols="50" class="large-text"><?php echo $this->GetOption('header_files') ? htmlspecialchars(implode("\n", $this->GetOption('header_files'))) : ''; ?></textarea>
230
- <span class="setting-description"><?php _e('Enter each header file used in your template, one per line. Typically, this is <code>header.php</code>.'); ?></span>
231
- </td>
232
- </tr>
233
- <tr valign="top">
234
- <th scope="row"><label for="header_html"><?php _e('Template HTML After Header'); ?></label></th>
235
- <td>
236
- <textarea name="header_html" id="header_html" rows="5" cols="50" class="large-text"><?php echo $this->GetOption('header_html') ? htmlspecialchars($this->GetOption('header_html')) : ''; ?></textarea>
237
- <span class="setting-description"><?php _e('Enter the HTML that appears after the get_header() function and before the page code.'); ?></span>
238
- </td>
239
- </tr>
240
- <tr valign="top">
241
- <th scope="row"><label for="footer_html"><?php _e('Template HTML Before Footer'); ?></label></th>
242
- <td>
243
- <textarea name="footer_html" id="footer_html" rows="5" cols="50" class="large-text"><?php echo $this->GetOption('footer_html') ? htmlspecialchars($this->GetOption('footer_html')) : ''; ?></textarea>
244
- <span class="setting-description"><?php _e('Enter footer HTML that appears between the page code and the get_sidebar()/get_footer() functions.'); ?></span>
245
- </td>
246
- </tr>
247
- <tr valign="top">
248
- <th scope="row"><label for="footer_files"><?php _e('Template Footer Files'); ?></label></th>
249
- <td>
250
- <textarea name="footer_files" id="footer_files" rows="5" cols="50" class="large-text"><?php echo $this->GetOption('footer_files') ? htmlspecialchars(implode("\n", $this->GetOption('footer_files'))) : ''; ?></textarea>
251
- <span class="setting-description"><?php _e('Enter each footer file used in your template, one per line. Typically, this is <code>sidebar.php</code> and <code>footer.php</code>.'); ?></span>
252
- </td>
253
- </tr>
254
- </table>
255
- <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />
256
- </form>
257
- </div>
258
- <?php
259
  }
260
-
261
  function Init() {
262
  global $pagenow;
263
-
264
- switch ($pagenow) {
265
- case "wp-login.php":
266
- case "wp-register.php":
267
- $this->DoLogin();
268
- break;
269
- }
270
 
271
- if ( is_admin() && current_user_can('edit_posts') === false && $pagenow != 'profile.php') {
272
- $redirect_to = get_bloginfo('wpurl') . '/wp-admin/profile.php';
 
 
 
 
 
273
  wp_safe_redirect($redirect_to);
274
- die();
275
  }
276
- }
277
-
278
- function DoHeader($title = 'Log In', $message = '', $wp_error = '') {
279
- global $error;
280
 
281
- if ( empty($wp_error) )
282
- $wp_error = new WP_Error();
283
-
284
- $header_files = $this->GetOption('header_files');
285
- foreach((array)$header_files as $header_file) {
286
- if (file_exists(TEMPLATEPATH . '/' . $header_file))
287
- include(TEMPLATEPATH . '/' . $header_file);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  }
289
-
290
- echo $this->GetOption('header_html');
291
- ?>
292
 
293
- <div id="login">
294
- <h2><?php _e($title); ?></h2>
295
-
296
- <?php
297
-
298
- if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
299
-
300
- // Incase a plugin uses $error rather than the $errors object
301
- if ( !empty( $error ) ) {
302
- $wp_error->add('error', $error);
303
- unset($error);
304
- }
305
-
306
- if ( $wp_error->get_error_code() ) {
307
- $errors = '';
308
- $messages = '';
309
- foreach ( $wp_error->get_error_codes() as $code ) {
310
- $severity = $wp_error->get_error_data($code);
311
- foreach ( $wp_error->get_error_messages($code) as $error ) {
312
- if ( 'message' == $severity )
313
- $messages .= ' ' . $error . "<br />\n";
314
- else
315
- $errors .= ' ' . $error . "<br />\n";
316
- }
317
- }
318
- if ( !empty($errors) )
319
- echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
320
- if ( !empty($messages) )
321
- echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
322
-
323
- }
324
- }
325
-
326
- function DoLogin() {
327
  $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
328
- $errors = new WP_Error();
329
 
330
  if ( isset($_GET['key']) )
331
  $action = 'resetpass';
332
-
333
  nocache_headers();
334
 
335
  if ( defined('RELOCATE') ) { // Move flag is set
@@ -342,94 +212,40 @@ if (!class_exists('ThemeMyLogin')) {
342
  }
343
 
344
  //Set a cookie now to see if they are supported by the browser.
345
- setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
346
  if ( SITECOOKIEPATH != COOKIEPATH )
347
- setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
348
-
349
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
350
- switch ($action) :
351
-
352
- case 'logout' :
353
- if ($wp_version > '2.6')
354
- check_admin_referer('log-out');
355
- wp_logout();
356
-
357
- if ($this->GetOption('logout_redirect')) {
358
- $redirect_to = $this->GetOption('logout_redirect');
359
- } else {
360
- if ( isset( $_REQUEST['redirect_to'] ) )
361
- $redirect_to = $_REQUEST['redirect_to'];
362
- else
363
- $redirect_to = 'wp-login.php';
364
  }
365
-
366
- wp_safe_redirect($redirect_to);
367
- exit();
368
- break;
369
-
370
- case 'lostpassword' :
371
- case 'retrievepassword' :
 
 
372
  if ( $http_post ) {
373
- $errors = retrieve_password();
374
- if ( !is_wp_error($errors) ) {
375
  wp_redirect('wp-login.php?checkemail=confirm');
376
  exit();
377
  }
378
  }
379
-
380
- if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
381
-
382
- do_action('lost_password');
383
- $this->DoHeader(__($this->GetOption('password_text')), '<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors);
384
-
385
- $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
386
-
387
- ?>
388
-
389
- <form name="lostpasswordform" id="lostpasswordform" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" method="post">
390
- <p>
391
- <label><?php _e('Username or E-mail:') ?><br />
392
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
393
- </p>
394
- <?php do_action('lostpassword_form'); ?>
395
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" tabindex="100" /></p>
396
- </form>
397
-
398
- <ul class="nav">
399
- <li><a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a></li>
400
- <?php if (get_option('users_can_register')) : ?>
401
- <li><a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></li>
402
- <?php endif; ?>
403
- </ul>
404
-
405
- </div>
406
-
407
- <?php
408
- echo $this->GetOption('footer_html');
409
- $footer_files = $this->GetOption('footer_files');
410
- foreach((array)$footer_files as $footer_file) {
411
- if (file_exists(TEMPLATEPATH . '/' . $footer_file))
412
- include(TEMPLATEPATH . '/' . $footer_file);
413
- }
414
-
415
- die();
416
- break;
417
-
418
- case 'resetpass' :
419
- case 'rp' :
420
- $errors = reset_password($_GET['key']);
421
-
422
- if ( ! is_wp_error($errors) ) {
423
- wp_redirect('wp-login.php?checkemail=newpass');
424
- exit();
425
- }
426
-
427
- wp_redirect('wp-login.php?action=lostpassword&error=invalidkey');
428
- exit();
429
-
430
- break;
431
-
432
- case 'register' :
433
  if ( !get_option('users_can_register') ) {
434
  wp_redirect('wp-login.php?registration=disabled');
435
  exit();
@@ -439,53 +255,17 @@ if (!class_exists('ThemeMyLogin')) {
439
  $user_email = '';
440
  if ( $http_post ) {
441
  require_once( ABSPATH . WPINC . '/registration.php');
442
-
443
  $user_login = $_POST['user_login'];
444
  $user_email = $_POST['user_email'];
445
- $errors = register_new_user($user_login, $user_email);
446
- if ( !is_wp_error($errors) ) {
447
  wp_redirect('wp-login.php?checkemail=registered');
448
  exit();
449
  }
450
  }
451
-
452
- $this->DoHeader(__($this->GetOption('register_text')), '', $errors);
453
- ?>
454
-
455
- <form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
456
- <p>
457
- <label><?php _e('Username') ?><br />
458
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
459
- </p>
460
- <p>
461
- <label><?php _e('E-mail') ?><br />
462
- <input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
463
- </p>
464
- <?php do_action('register_form'); ?>
465
- <p id="reg_passmail"><?php _e($this->GetOption('register_msg')) ?></p>
466
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register'); ?>" tabindex="100" /></p>
467
- </form>
468
-
469
- <ul class="nav">
470
- <li><a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a></li>
471
- <li><a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
472
- </ul>
473
-
474
- </div>
475
-
476
- <?php
477
- echo $this->GetOption('footer_html');
478
- $footer_files = $this->GetOption('footer_files');
479
- foreach((array)$footer_files as $footer_file) {
480
- if (file_exists(TEMPLATEPATH . '/' . $footer_file))
481
- include(TEMPLATEPATH . '/' . $footer_file);
482
- }
483
-
484
- die();
485
- break;
486
-
487
- case 'login' :
488
- default:
489
  $secure_cookie = '';
490
 
491
  // If the user wants ssl but the session is not ssl, force a secure cookie.
@@ -522,76 +302,262 @@ if (!class_exists('ThemeMyLogin')) {
522
  wp_safe_redirect($redirect_to);
523
  exit();
524
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
 
526
- $errors = $user;
527
- // Clear errors if loggedout is set.
528
- if ( !empty($_GET['loggedout']) )
529
- $errors = new WP_Error();
 
530
 
531
- // If cookies are disabled we can't log in even with a valid user+pass
532
- if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
533
- $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
534
 
535
- // Some parts of this script use the main login form to display a message
536
- if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) $errors->add('loggedout', __('You are now logged out.'), 'message');
537
- elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $errors->add('registerdisabled', __('User registration is currently not allowed.'));
538
- elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
539
- elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
540
- elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
541
 
542
- $this->DoHeader(__($this->GetOption('login_text')), '', $errors);
543
 
544
- if ( isset($_POST['log']) )
545
- $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  ?>
547
 
548
- <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
549
- <form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php', 'login_post') ?>" method="post">
550
- <p>
551
- <label><?php _e('Username') ?><br />
552
- <input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="20" tabindex="10" /></label>
553
- </p>
554
- <p>
555
- <label><?php _e('Password') ?><br />
556
- <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
557
- </p>
558
- <?php do_action('login_form'); ?>
559
- <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me'); ?></label></p>
560
- <p class="submit">
561
- <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
562
- <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
563
- <input type="hidden" name="testcookie" value="1" />
564
- </p>
565
- </form>
566
- <?php endif; ?>
567
-
568
- <ul class="nav">
569
- <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
570
- <?php elseif (get_option('users_can_register')) : ?>
571
- <li><a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a></li>
572
- <?php endif; ?>
573
- <li><a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li>
574
- </ul>
575
-
576
- </div>
577
 
578
  <?php
579
- echo $this->GetOption('footer_html');
580
- $footer_files = $this->GetOption('footer_files');
581
- foreach((array)$footer_files as $footer_file) {
582
- if (file_exists(TEMPLATEPATH . '/' . $footer_file))
583
- include(TEMPLATEPATH . '/' . $footer_file);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  }
 
 
 
 
585
 
586
- die();
587
- break;
588
- endswitch;
589
  }
590
 
591
- function DoProfile() {
 
 
 
 
 
 
 
 
 
 
 
 
592
 
593
- function ProfileJS ( ) {
594
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  <script type="text/javascript">
596
  function update_nickname ( ) {
597
 
@@ -615,208 +581,34 @@ if (!class_exists('ThemeMyLogin')) {
615
  jQuery('#nickname').blur(update_nickname);
616
  });
617
  </script>
618
- <?php
619
- }
620
 
621
- function ProfileCSS ( ) {
622
- ?>
623
- <style type="text/css">
624
- table.form-table th, table.form-table td {
625
- padding: 0;
626
- }
627
- table.form-table th {
628
- width: 150px;
629
- vertical-align: text-top;
630
- text-align: left;
631
- }
632
- p.message {
633
- padding: 3px 5px;
634
- background-color: lightyellow;
635
- border: 1px solid yellow;
636
- }
637
- #display_name {
638
- width: 250px;
639
- }
640
- .field-hint {
641
- display: block;
642
- clear: both;
643
- }
644
- </style>
645
- <?php
646
  }
647
-
648
- if ( !$user_id ) {
649
- $current_user = wp_get_current_user();
650
- $user_id = $current_user->ID;
651
  }
652
-
653
- if ($current_user->has_cap('edit_posts') === false) {
654
- $is_profile_page = true;
655
- //add_filter('wp_title','cyc_title');
656
- add_action('wp_head', 'ProfileJS');
657
- add_action('wp_head', 'ProfileCSS');
658
-
659
- wp_enqueue_script('jquery');
660
-
661
- wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
662
- $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
663
- $user_id = (int) $user_id;
664
-
665
- $profileuser = get_user_to_edit($user_id);
666
- if ( !current_user_can('edit_user', $user_id) )
667
- wp_die(__('You do not have permission to edit this user.'));
668
-
669
- $this->DoHeader(__($this->GetOption('profile_text')), '', $errors);
670
- if ($_GET['updated'] == true) {
671
- echo '<p class="message">Your profile has been updated.</p>';
672
- }
673
- ?>
674
-
675
- <form name="profile" id="your-profile" action="" method="post">
676
- <?php wp_nonce_field('update-user_' . $user_id) ?>
677
- <?php if ( $wp_http_referer ) : ?>
678
- <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
679
- <?php endif; ?>
680
- <p>
681
- <input type="hidden" name="from" value="profile" />
682
- <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
683
- </p>
684
-
685
- <h3><?php _e('Name') ?></h3>
686
-
687
- <table class="form-table">
688
- <tr>
689
- <th><label for="user_login"><?php _e('Username'); ?></label></th>
690
- <td><input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> <?php _e('Your username cannot be changed'); ?></td>
691
- </tr>
692
- <tr>
693
- <th><label for="first_name"><?php _e('First name') ?></label></th>
694
- <td><input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></td>
695
- </tr>
696
- <tr>
697
- <th><label for="last_name"><?php _e('Last name') ?></label></th>
698
- <td><input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></td>
699
- </tr>
700
- <tr>
701
- <th><label for="nickname"><?php _e('Nickname') ?></label></th>
702
- <td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></td>
703
- </tr>
704
- <tr>
705
- <th><label for="display_name"><?php _e('Display name publicly&nbsp;as') ?></label></th>
706
- <td>
707
- <select name="display_name" id="display_name">
708
- <?php
709
- $public_display = array();
710
- $public_display['display_displayname'] = $profileuser->display_name;
711
- $public_display['display_nickname'] = $profileuser->nickname;
712
- $public_display['display_username'] = $profileuser->user_login;
713
- $public_display['display_firstname'] = $profileuser->first_name;
714
- $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
715
- $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
716
- $public_display = array_unique(array_filter(array_map('trim', $public_display)));
717
- foreach($public_display as $id => $item) {
718
- ?>
719
- <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
720
- <?php
721
- }
722
- ?>
723
- </select>
724
- </td>
725
- </tr>
726
- </table>
727
-
728
- <h3><?php _e('Contact Info') ?></h3>
729
-
730
- <table class="form-table">
731
- <tr>
732
- <th><label for="email"><?php _e('E-mail') ?></label></th>
733
- <td><input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /> <?php _e('Required'); ?></td>
734
- </tr>
735
-
736
- <tr>
737
- <th><label for="url"><?php _e('Website') ?></label></th>
738
- <td><input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" /></td>
739
- </tr>
740
-
741
- <tr>
742
- <th><label for="aim"><?php _e('AIM') ?></label></th>
743
- <td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" /></td>
744
- </tr>
745
-
746
- <tr>
747
- <th><label for="yim"><?php _e('Yahoo IM') ?></label></th>
748
- <td><input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" /></td>
749
- </tr>
750
-
751
- <tr>
752
- <th><label for="jabber"><?php _e('Jabber / Google Talk') ?></label></th>
753
- <td><input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></td>
754
- </tr>
755
- </table>
756
-
757
- <h3><?php _e('About Yourself'); ?></h3>
758
-
759
- <table class="form-table">
760
- <tr>
761
- <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
762
- <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea><br /><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?><br/><br/></td>
763
- </tr>
764
-
765
- <?php
766
- $show_password_fields = apply_filters('show_password_fields', true);
767
- if ( $show_password_fields ) :
768
- ?>
769
- <tr>
770
- <th><label for="pass1"><?php _e('New Password'); ?></label></th>
771
- <td>
772
- <input type="password" name="pass1" id="pass1" size="16" value="" /><br/><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
773
- <input type="password" name="pass2" id="pass2" size="16" value="" /><br/><?php _e("Type your new password again."); ?><br />
774
- </td>
775
- </tr>
776
- <?php endif; ?>
777
- </table>
778
-
779
- <?php
780
- do_action('profile_personal_options');
781
- do_action('show_user_profile');
782
- ?>
783
-
784
- <?php if (count($profileuser->caps) > count($profileuser->roles)): ?>
785
- <br class="clear" />
786
- <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
787
- <tr>
788
- <th scope="row"><?php _e('Additional Capabilities') ?></th>
789
- <td><?php
790
- $output = '';
791
- foreach($profileuser->caps as $cap => $value) {
792
- if(!$wp_roles->is_role($cap)) {
793
- if($output != '') $output .= ', ';
794
- $output .= $value ? $cap : "Denied: {$cap}";
795
- }
796
- }
797
- echo $output;
798
- ?></td>
799
- </tr>
800
- </table>
801
- <?php endif; ?>
802
-
803
- <p class="submit">
804
- <input type="hidden" name="action" value="update" />
805
- <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
806
- <input type="submit" id="cycsubmit" value="<?php $is_profile_page? _e('Update Profile') : _e('Update User') ?>" name="submit" />
807
- </p>
808
- </form>
809
- </div>
810
- <?php
811
- echo $this->GetOption('footer_html');
812
- $footer_files = $this->GetOption('footer_files');
813
- foreach((array)$footer_files as $footer_file) {
814
- if (file_exists(TEMPLATEPATH . '/' . $footer_file))
815
- include(TEMPLATEPATH . '/' . $footer_file);
816
- }
817
-
818
- die();
819
  }
 
 
 
 
 
 
820
  }
821
  }
822
  }
@@ -826,81 +618,4 @@ if (class_exists('ThemeMyLogin')) {
826
  $ThemeMyLogin = new ThemeMyLogin();
827
  }
828
 
829
- if ( !function_exists('is_ssl') ) :
830
- function is_ssl() {
831
- if ( isset($_SERVER['HTTPS']) ) {
832
- if ( 'on' == strtolower($_SERVER['HTTPS']) )
833
- return true;
834
- if ( '1' == $_SERVER['HTTPS'] )
835
- return true;
836
- } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
837
- return true;
838
- }
839
- return false;
840
- }
841
- endif;
842
-
843
- if ( !function_exists('site_url') ) :
844
- function site_url($path = '', $scheme = null) {
845
- // should the list of allowed schemes be maintained elsewhere?
846
- $orig_scheme = $scheme;
847
- if ( !in_array($scheme, array('http', 'https')) ) {
848
- if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
849
- $scheme = 'https';
850
- elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
851
- $scheme = 'https';
852
- elseif ( ('admin' == $scheme) && force_ssl_admin() )
853
- $scheme = 'https';
854
- else
855
- $scheme = ( is_ssl() ? 'https' : 'http' );
856
- }
857
-
858
- $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
859
-
860
- if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
861
- $url .= '/' . ltrim($path, '/');
862
-
863
- return apply_filters('site_url', $url, $path, $orig_scheme);
864
- }
865
- endif;
866
-
867
- if ( !function_exists('admin_url') ) :
868
- function admin_url($path = '') {
869
- $url = site_url('wp-admin/', 'admin');
870
-
871
- if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
872
- $url .= ltrim($path, '/');
873
-
874
- return $url;
875
- }
876
- endif;
877
-
878
- if ( !function_exists('force_ssl_login') ) :
879
- function force_ssl_login($force = '') {
880
- static $forced;
881
-
882
- if ( '' != $force ) {
883
- $old_forced = $forced;
884
- $forced = $force;
885
- return $old_forced;
886
- }
887
-
888
- return $forced;
889
- }
890
- endif;
891
-
892
- if ( !function_exists('force_ssl_admin') ) :
893
- function force_ssl_admin($force = '') {
894
- static $forced;
895
-
896
- if ( '' != $force ) {
897
- $old_forced = $forced;
898
- $forced = $force;
899
- return $old_forced;
900
- }
901
-
902
- return $forced;
903
- }
904
- endif;
905
-
906
  ?>
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://webdesign.jaedub.com/wordpress-plugins/theme-my-login-plugin
5
  Description: Themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
6
+ Version: 2.0
7
  Author: Jae Dub
8
  Author URI: http://webdesign.jaedub.com
9
 
19
  Prepared plugin for internationalization and fixed a PHP version bug
20
  1.1.2 - 2009-03-20
21
  Updated to allow customization of text below registration form
22
+ 1.2.0 - 2009-03-26
23
+ Added capability to customize page titles for all pages affected by plugin
24
+ 2.0.0 - 2009-03-27
25
+ Completely rewrote plugin to use page template, no more specifying template files & HTML
26
  */
27
 
28
  if (!class_exists('ThemeMyLogin')) {
29
  class ThemeMyLogin {
30
+
31
  var $options = array();
32
+ var $is_login = false;
33
+ var $errors = '';
34
 
35
  function ThemeMyLogin() {
36
  $this->__construct();
39
  function __construct() {
40
  register_activation_hook ( __FILE__, array( &$this, 'Activate' ) );
41
  register_deactivation_hook ( __FILE__, array( &$this, 'Deactivate' ) );
42
+
43
  add_action('init', array(&$this, 'Init'));
44
  add_action('admin_menu', array(&$this, 'AddAdminPage'));
45
 
46
+ add_action('wp_print_scripts', array(&$this, 'DoLogin'));
47
+
48
+ add_filter('wp_title', array(&$this, 'WPTitle'));
49
+ add_filter('the_title', array(&$this, 'TheTitle'));
50
 
51
+ add_filter('wp_list_pages_excludes', array(&$this, 'ListPagesExcludes'));
52
+
53
+ if ($_GET['show'] == 'profile') {
54
+ add_action('wp_head', array(&$this, 'ProfileJS'));
55
+ add_action('wp_head', array(&$this, 'ProfileCSS'));
56
+ wp_enqueue_script('jquery');
57
+ }
58
  }
 
 
59
 
60
+ function Activate() {
61
+ if (get_option('tml_options'))
62
+ delete_option('tml_options');
63
+
64
+ $theme_my_login = get_page_by_title('Login');
65
+ if (!$theme_my_login) {
66
+ $insert = array(
67
+ 'post_title' => 'Login',
68
+ 'post_status' => 'publish',
69
+ 'post_type' => 'page',
70
+ 'post_author' => 1,
71
+ 'post_content' => 'Please do not edit or remove me!'
72
+ );
73
+
74
+ $theme_my_login = wp_insert_post($insert);
75
+ } else $theme_my_login = $theme_my_login->ID;
76
+
77
+ $this->SetOption( 'page_id', $theme_my_login );
78
+ $this->SaveOptions();
79
  }
80
+
81
  function Deactivate() {
82
+ if ($this->GetOption('chk_uninstall')) {
83
+ delete_option('theme_my_login');
84
+ wp_delete_post($this->GetOption('page_id'));
85
+ }
86
  }
87
+
88
  # Sets up default options
89
  function InitOptions() {
90
+ $this->options['version'] = '2.0';
91
+ $this->options['chk_uninstall'] = 0;
92
+ $this->options['page_id'] = '0';
93
+ $this->options['login_redirect'] = 'wp-admin/';
94
+ $this->options['logout_redirect'] = 'wp-login.php?loggedout=true';
95
+ $this->options['login_title'] = '%blogname% &rsaquo; Log In';
96
+ $this->options['login_text'] = 'Log In';
97
+ $this->options['register_title'] = '%blogname% &rsaquo; Register';
98
+ $this->options['register_text'] = 'Register';
99
+ $this->options['register_msg'] = 'A password will be e-mailed to you.';
100
+ $this->options['password_title'] = '%blogname% &rsaquo; Lost Password';
101
+ $this->options['password_text'] = 'Lost Password';
102
+ $this->options['profile_title'] = '%blogname% &rsaquo; Profile';
103
+ $this->options['profile_text'] = 'Your Profile';
104
  }
105
 
106
  # Loads options from database
108
 
109
  $this->InitOptions();
110
 
111
+ $storedoptions = get_option( 'theme_my_login' );
112
  if ( $storedoptions && is_array( $storedoptions ) ) {
113
  foreach ( $storedoptions as $key => $value ) {
114
  $this->options[$key] = $value;
115
  }
116
+ } else update_option( 'theme_my_login', $this->options );
117
  }
118
 
119
  # Returns option value for given key
120
  function GetOption( $key ) {
 
121
  if ( array_key_exists( $key, $this->options ) ) {
122
  return $this->options[$key];
123
  } else return null;
125
 
126
  # Sets the speficied option key to a new value
127
  function SetOption( $key, $value ) {
 
 
128
  $this->options[$key] = $value;
129
  }
130
 
131
  # Saves the options to the database
132
  function SaveOptions() {
133
+ $oldvalue = get_option( 'theme_my_login' );
134
  if( $oldvalue == $this->options ) {
135
  return true;
136
+ } else return update_option( 'theme_my_login', $this->options );
137
  }
138
 
139
  function AddAdminPage(){
141
  }
142
 
143
  function AdminPage(){
144
+ include 'includes/admin-page.php';
145
+ }
146
+
147
+ function QueryURL() {
148
+ global $wp_rewrite;
149
 
150
+ $url = get_permalink( $this->GetOption('page_id') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
+ if ($wp_rewrite->using_permalinks())
153
+ return $url . '?';
154
+ else
155
+ return $url . '&';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
+
158
  function Init() {
159
  global $pagenow;
 
 
 
 
 
 
 
160
 
161
+ $this->LoadOptions();
162
+ $url = $this->QueryURL();
163
+
164
+ if ( is_admin() && current_user_can('edit_posts') === false && !isset($_POST['from']) && $_POST['from'] != 'profile' ) {
165
+ $redirect_to = $url . 'show=profile';
166
+ if ($_GET['updated'] == true)
167
+ $redirect_to = $redirect_to . '&updated=true';
168
  wp_safe_redirect($redirect_to);
169
+ exit;
170
  }
 
 
 
 
171
 
172
+ switch ($pagenow) {
173
+ case 'wp-register.php':
174
+ case 'wp-login.php':
175
+ if (isset($_GET)) :
176
+ $count = 1;
177
+ foreach($_GET as $key => $value) :
178
+ if (strpos($url, '?') !== false) :
179
+ if ($count == 1)
180
+ $url .= $key . '=' . $value;
181
+ else
182
+ $url .= '&' . $key . '=' . $value;
183
+ else :
184
+ $url .= '?' . $key . '=' . $value;
185
+ endif;
186
+ $count++;
187
+ endforeach;
188
+ else :
189
+ $url = get_permalink( $this->GetOption('page_id') );
190
+ endif;
191
+ wp_safe_redirect($url);
192
+ exit;
193
+ break;
194
  }
 
 
 
195
 
196
+ $this->errors = new WP_Error();
197
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
 
199
 
200
  if ( isset($_GET['key']) )
201
  $action = 'resetpass';
202
+
203
  nocache_headers();
204
 
205
  if ( defined('RELOCATE') ) { // Move flag is set
212
  }
213
 
214
  //Set a cookie now to see if they are supported by the browser.
215
+ setcookie(TEST_COOKIE, 'Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
216
  if ( SITECOOKIEPATH != COOKIEPATH )
217
+ setcookie(TEST_COOKIE, 'Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
218
+
219
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
220
+
221
+ if (isset($_POST['show']) && $_POST['show'] == 'profile') {
222
+ if ( !$user_id ) {
223
+ $current_user = wp_get_current_user();
224
+ $user_id = $current_user->ID;
225
+ if (!$user_id) {
226
+ wp_redirect('wp-login.php');
227
+ exit;
228
+ }
 
 
 
 
 
229
  }
230
+ }
231
+
232
+ switch ($action) :
233
+ case 'logout':
234
+ $this->Logout();
235
+ break;
236
+ case 'lostpassword':
237
+ case 'retrievepassword':
238
+ require('includes/compat.php');
239
  if ( $http_post ) {
240
+ $this->errors = retrieve_password();
241
+ if ( !is_wp_error($this->errors) ) {
242
  wp_redirect('wp-login.php?checkemail=confirm');
243
  exit();
244
  }
245
  }
246
+ break;
247
+ case 'register':
248
+ require('includes/compat.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  if ( !get_option('users_can_register') ) {
250
  wp_redirect('wp-login.php?registration=disabled');
251
  exit();
255
  $user_email = '';
256
  if ( $http_post ) {
257
  require_once( ABSPATH . WPINC . '/registration.php');
258
+
259
  $user_login = $_POST['user_login'];
260
  $user_email = $_POST['user_email'];
261
+ $this->errors = register_new_user($user_login, $user_email);
262
+ if ( !is_wp_error($this->errors) ) {
263
  wp_redirect('wp-login.php?checkemail=registered');
264
  exit();
265
  }
266
  }
267
+ break;
268
+ case 'login':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  $secure_cookie = '';
270
 
271
  // If the user wants ssl but the session is not ssl, force a secure cookie.
302
  wp_safe_redirect($redirect_to);
303
  exit();
304
  }
305
+
306
+ $this->errors = $user;
307
+
308
+ break;
309
+
310
+ case 'update':
311
+ if (isset($_POST['from']) && $_POST['from'] == 'profile') {
312
+
313
+ if ( !$user_id ) {
314
+ $current_user = wp_get_current_user();
315
+ $user_id = $current_user->ID;
316
+ if (!$user_id) {
317
+ wp_redirect('wp-login.php');
318
+ exit;
319
+ }
320
+ }
321
 
322
+ //include ABSPATH . '/wp-admin/includes/misc.php';
323
+ include ABSPATH . '/wp-admin/includes/user.php';
324
+ include ABSPATH . 'wp-includes/registration-functions.php';
325
+
326
+ check_admin_referer('update-user_' . $user_id);
327
 
328
+ if ( !current_user_can('edit_user', $user_id) )
329
+ wp_die(__('You do not have permission to edit this user.'));
 
330
 
331
+ do_action('personal_options_update');
 
 
 
 
 
332
 
333
+ $this->errors = edit_user($user_id);
334
 
335
+ if ( !is_wp_error( $this->errors ) ) {
336
+ $redirect = 'wp-admin/profile.php?updated=true';
337
+ $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
338
+ wp_redirect($redirect);
339
+ exit;
340
+ }
341
+ }
342
+ break;
343
+ endswitch;
344
+ }
345
+
346
+ function DoLogin() {
347
+ global $wp_query;
348
+
349
+ if ((is_page()) && ($wp_query->post->ID == $this->GetOption('page_id'))) :
350
+
351
+ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
352
+ $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
353
+
354
+ if ( isset($_GET['key']) )
355
+ $action = 'resetpass';
356
+
357
+ if ($_GET['show'] == 'profile') {
358
+ add_filter('the_content', array(&$this, 'Profile'));
359
+ } else {
360
+
361
+ switch ($action) {
362
+ case 'lostpassword' :
363
+ case 'retrievepassword' :
364
+ add_filter('the_content', array(&$this, 'LostPassword'));
365
+ break;
366
+ case 'resetpass' :
367
+ case 'rp' :
368
+ $this->ResetPass();
369
+ break;
370
+ case 'register' :
371
+ add_filter('the_content', array(&$this, 'Register'));
372
+ break;
373
+ case 'login' :
374
+ default:
375
+ add_filter('the_content', array(&$this, 'Login'));
376
+ break;
377
+ }
378
+ }
379
+ endif;
380
+ }
381
+
382
+ function WPTitle($title) {
383
+ if (is_page($this->GetOption('page_id'))) {
384
+ if ($_GET['show'] == 'profile')
385
+ return str_replace('%blogname%', get_option('blogname'), $this->GetOption('profile_title'));
386
+
387
+ switch ($_GET['action']) {
388
+ case 'register':
389
+ return str_replace('%blogname%', get_option('blogname'), $this->GetOption('register_title'));
390
+ break;
391
+ case 'lostpassword':
392
+ case 'retrievepassword':
393
+ case 'resetpass':
394
+ case 'rp':
395
+ return str_replace('%blogname%', get_option('blogname'), $this->GetOption('password_title'));
396
+ break;
397
+ case 'login':
398
+ default:
399
+ return str_replace('%blogname%', get_option('blogname'), $this->GetOption('login_title'));
400
+ }
401
+ } return $title;
402
+ }
403
+
404
+ function TheTitle($title) {
405
+ if ($title == 'Login') {
406
+ if ($_GET['show'] == 'profile')
407
+ return $this->GetOption('profile_text');
408
+
409
+ switch ($_GET['action']) {
410
+ case 'register':
411
+ return $this->GetOption('register_text');
412
+ break;
413
+ case 'lostpassword':
414
+ case 'retrievepassword':
415
+ case 'resetpass':
416
+ case 'rp':
417
+ return $this->GetOption('password_text');
418
+ break;
419
+ case 'login':
420
+ default:
421
+ return $this->GetOption('login_text');
422
+ }
423
+ } return $title;
424
+ }
425
+
426
+ function ListPagesExcludes($excludes) {
427
+ $excludes[] = $this->GetOption( 'page_id' );
428
+
429
+ return $excludes;
430
+ }
431
+
432
+ function DoHeader($message = '', $wp_error = '') {
433
+ global $error;
434
+
435
+ if ( empty($wp_error) )
436
+ $wp_error = new WP_Error();
437
  ?>
438
 
439
+ <div id="login">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
 
441
  <?php
442
+
443
+ if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
444
+
445
+ // Incase a plugin uses $error rather than the $errors object
446
+ if ( !empty( $error ) ) {
447
+ $wp_error->add('error', $error);
448
+ unset($error);
449
+ }
450
+
451
+ if ( $wp_error->get_error_code() ) {
452
+ $errors = '';
453
+ $messages = '';
454
+ foreach ( $wp_error->get_error_codes() as $code ) {
455
+ $severity = $wp_error->get_error_data($code);
456
+ foreach ( $wp_error->get_error_messages($code) as $error ) {
457
+ if ( 'message' == $severity )
458
+ $messages .= ' ' . $error . "<br />\n";
459
+ else
460
+ $errors .= ' ' . $error . "<br />\n";
461
+ }
462
  }
463
+ if ( !empty($errors) )
464
+ echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
465
+ if ( !empty($messages) )
466
+ echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
467
 
468
+ }
 
 
469
  }
470
 
471
+ function Logout() {
472
+ if ($wp_version > '2.6')
473
+ check_admin_referer('log-out');
474
+ wp_logout();
475
+
476
+ if ($this->GetOption('logout_redirect')) {
477
+ $redirect_to = $this->GetOption('logout_redirect');
478
+ } else {
479
+ if ( isset( $_REQUEST['redirect_to'] ) )
480
+ $redirect_to = $_REQUEST['redirect_to'];
481
+ else
482
+ $redirect_to = 'wp-login.php';
483
+ }
484
 
485
+ wp_safe_redirect($redirect_to);
486
+ exit();
487
+ }
488
+
489
+ function LostPassword() {
490
+ include 'includes/lost-password.php';
491
+ }
492
+
493
+ function ResetPass() {
494
+ if (!function_exists('reset_password')) :
495
+ function reset_password($key) {
496
+ global $wpdb;
497
+
498
+ require('includes/compat.php');
499
+
500
+ $key = preg_replace('/[^a-z0-9]/i', '', $key);
501
+
502
+ if ( empty( $key ) )
503
+ return new WP_Error('invalid_key', __('Invalid key'));
504
+
505
+ $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s", $key));
506
+ if ( empty( $user ) )
507
+ return new WP_Error('invalid_key', __('Invalid key'));
508
+
509
+ do_action('password_reset', $user);
510
+
511
+ // Generate something random for a password...
512
+ $new_pass = wp_generate_password();
513
+ wp_set_password($new_pass, $user->ID);
514
+ $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
515
+ $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
516
+ $message .= site_url('wp-login.php', 'login') . "\r\n";
517
+
518
+ if ( !wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message) )
519
+ die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
520
+
521
+ if ( !function_exists('wp_password_change_notification') ) :
522
+ function wp_password_change_notification(&$user) {
523
+ if ( $user->user_email != get_option('admin_email') ) {
524
+ $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
525
+ wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message);
526
+ }
527
+ }
528
+ endif;
529
+
530
+ wp_password_change_notification($user);
531
+
532
+ return true;
533
+ }
534
+ endif;
535
+
536
+ $errors = reset_password($_GET['key']);
537
+
538
+ if ( ! is_wp_error($errors) ) {
539
+ wp_redirect('wp-login.php?checkemail=newpass');
540
+ exit();
541
+ }
542
+
543
+ wp_redirect('wp-login.php?action=lostpassword&error=invalidkey');
544
+ exit();
545
+ }
546
+
547
+ function Register() {
548
+ include 'includes/register.php';
549
+ }
550
+
551
+ function Login() {
552
+ include 'includes/login.php';
553
+ }
554
+
555
+ function Profile() {
556
+ include 'includes/profile.php';
557
+ }
558
+
559
+ function ProfileJS ( ) {
560
+ ?>
561
  <script type="text/javascript">
562
  function update_nickname ( ) {
563
 
581
  jQuery('#nickname').blur(update_nickname);
582
  });
583
  </script>
584
+ <?php
585
+ }
586
 
587
+ function ProfileCSS ( ) {
588
+ ?>
589
+ <style type="text/css">
590
+ table.form-table th, table.form-table td {
591
+ padding: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  }
593
+ table.form-table th {
594
+ width: 150px;
595
+ vertical-align: text-top;
596
+ text-align: left;
597
  }
598
+ p.message {
599
+ padding: 3px 5px;
600
+ background-color: lightyellow;
601
+ border: 1px solid yellow;
602
+ }
603
+ #display_name {
604
+ width: 250px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
  }
606
+ .field-hint {
607
+ display: block;
608
+ clear: both;
609
+ }
610
+ </style>
611
+ <?php
612
  }
613
  }
614
  }
618
  $ThemeMyLogin = new ThemeMyLogin();
619
  }
620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  ?>