Theme My Login - Version 3.3.1

Version Description

  • Fixed a bug that broke password recovery due to the new system from WP 2.8.4
Download this release

Release Info

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

Code changes from version 3.3 to 3.3.1

includes/admin-page.php CHANGED
@@ -7,16 +7,16 @@ if ( $_POST ) {
7
 
8
  check_admin_referer('theme-my-login');
9
 
10
- $this->SetOption('uninstall', $_POST['uninstall']);
11
- $this->SetOption('show_page', $_POST['show_page']);
12
  $this->SetOption('login_title', stripslashes($_POST['login_title']));
13
  $this->SetOption('register_title', stripslashes($_POST['register_title']));
14
  $this->SetOption('register_msg', stripslashes($_POST['register_msg']));
15
  $this->SetOption('register_complete', stripslashes($_POST['register_complete']));
16
  $this->SetOption('password_title', stripslashes($_POST['password_title']));
17
  $this->SetOption('password_msg', stripslashes($_POST['password_msg']));
18
- $this->SetOption('widget_allow_register', $_POST['widget_allow_register']);
19
- $this->SetOption('widget_allow_password', $_POST['widget_allow_password']);
20
  foreach ($user_roles as $role => $value) {
21
  $dashboard_url[$role] = $_POST['widget_dashboard_url'][$role];
22
  $profile_url[$role] = $_POST['widget_profile_url'][$role];
7
 
8
  check_admin_referer('theme-my-login');
9
 
10
+ $this->SetOption('uninstall', isset($_POST['uninstall']));
11
+ $this->SetOption('show_page', isset($_POST['show_page']));
12
  $this->SetOption('login_title', stripslashes($_POST['login_title']));
13
  $this->SetOption('register_title', stripslashes($_POST['register_title']));
14
  $this->SetOption('register_msg', stripslashes($_POST['register_msg']));
15
  $this->SetOption('register_complete', stripslashes($_POST['register_complete']));
16
  $this->SetOption('password_title', stripslashes($_POST['password_title']));
17
  $this->SetOption('password_msg', stripslashes($_POST['password_msg']));
18
+ $this->SetOption('widget_allow_register', isset($_POST['widget_allow_register']));
19
+ $this->SetOption('widget_allow_password', isset($_POST['widget_allow_password']));
20
  foreach ($user_roles as $role => $value) {
21
  $dashboard_url[$role] = $_POST['widget_dashboard_url'][$role];
22
  $profile_url[$role] = $_POST['widget_profile_url'][$role];
includes/wp-login-actions.php CHANGED
@@ -64,7 +64,7 @@ case 'retrievepassword' :
64
  break;
65
  case 'resetpass' :
66
  case 'rp' :
67
- $login_errors = reset_password($_GET['key']);
68
 
69
  if ( ! is_wp_error($login_errors) ) {
70
  $redirect_to = ('widget' == $post_from) ? theme_my_login_url(array('checkemail' => 'newpass')) : site_url('wp-login.php?checkemail=newpass', 'login');
64
  break;
65
  case 'resetpass' :
66
  case 'rp' :
67
+ $login_errors = reset_password($_GET['key'], $_GET['login']);
68
 
69
  if ( ! is_wp_error($login_errors) ) {
70
  $redirect_to = ('widget' == $post_from) ? theme_my_login_url(array('checkemail' => 'newpass')) : site_url('wp-login.php?checkemail=newpass', 'login');
includes/wp-login-forms.php CHANGED
@@ -5,7 +5,9 @@ $options = get_option('theme_my_login');
5
  require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-functions.php');
6
 
7
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
8
- $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
 
 
9
 
10
  if (empty($type))
11
  $type = 'page';
@@ -23,18 +25,18 @@ case 'retrievepassword' :
23
  <form name="lostpasswordform" id="lostpasswordform" action="" method="post">
24
  <p>
25
  <label><?php _e('Username or E-mail:') ?><br />
26
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
27
  </p>
28
  <?php do_action('lostpassword_form'); ?>
29
  <p class="submit">
30
  <input type="hidden" name="post-from" id="post-from" value="<?php echo $type; ?>" />
31
  <input type="hidden" name="action" id="action" value="lostpassword" />
32
- <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" tabindex="100" />
33
  </p>
34
  </form>
35
 
36
  <?php
37
- login_footer($type);
38
  break;
39
 
40
  case 'register' :
@@ -46,23 +48,23 @@ case 'register' :
46
  <form name="registerform" id="registerform" action="" method="post">
47
  <p>
48
  <label><?php _e('Username') ?><br />
49
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
50
  </p>
51
  <p>
52
  <label><?php _e('E-mail') ?><br />
53
- <input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" tabindex="20" /></label>
54
  </p>
55
  <?php do_action('register_form'); ?>
56
  <p id="reg_passmail"><?php echo $options['register_msg']; ?></p>
57
  <p class="submit">
58
  <input type="hidden" name="post-from" id="post-from" value="<?php echo $type; ?>" />
59
  <input type="hidden" name="action" id="action" value="register" />
60
- <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register'); ?>" tabindex="100" />
61
  </p>
62
  </form>
63
 
64
  <?php
65
- login_footer($type);
66
  break;
67
 
68
  case 'login' :
@@ -103,18 +105,18 @@ default :
103
  <form name="loginform" id="loginform" action="" method="post">
104
  <p>
105
  <label><?php _e('Username') ?><br />
106
- <input type="text" name="log" id="user_login" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" tabindex="10" /></label>
107
  </p>
108
  <p>
109
  <label><?php _e('Password') ?><br />
110
- <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
111
  </p>
112
  <?php do_action('login_form'); ?>
113
- <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me'); ?></label></p>
114
  <p class="submit">
115
  <input type="hidden" name="post-from" id="post-from" value="<?php echo $type; ?>" />
116
  <input type="hidden" name="action" id="action" value="login" />
117
- <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
118
  <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
119
  <input type="hidden" name="testcookie" value="1" />
120
  </p>
@@ -122,7 +124,7 @@ default :
122
  <?php endif; ?>
123
 
124
  <?php
125
- login_footer($type);
126
  break;
127
 
128
  endswitch;
5
  require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-functions.php');
6
 
7
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
8
+
9
+ if (empty($action))
10
+ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
11
 
12
  if (empty($type))
13
  $type = 'page';
25
  <form name="lostpasswordform" id="lostpasswordform" action="" method="post">
26
  <p>
27
  <label><?php _e('Username or E-mail:') ?><br />
28
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" /></label>
29
  </p>
30
  <?php do_action('lostpassword_form'); ?>
31
  <p class="submit">
32
  <input type="hidden" name="post-from" id="post-from" value="<?php echo $type; ?>" />
33
  <input type="hidden" name="action" id="action" value="lostpassword" />
34
+ <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" />
35
  </p>
36
  </form>
37
 
38
  <?php
39
+ login_footer($type, $action);
40
  break;
41
 
42
  case 'register' :
48
  <form name="registerform" id="registerform" action="" method="post">
49
  <p>
50
  <label><?php _e('Username') ?><br />
51
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" /></label>
52
  </p>
53
  <p>
54
  <label><?php _e('E-mail') ?><br />
55
+ <input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="20" /></label>
56
  </p>
57
  <?php do_action('register_form'); ?>
58
  <p id="reg_passmail"><?php echo $options['register_msg']; ?></p>
59
  <p class="submit">
60
  <input type="hidden" name="post-from" id="post-from" value="<?php echo $type; ?>" />
61
  <input type="hidden" name="action" id="action" value="register" />
62
+ <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register'); ?>" />
63
  </p>
64
  </form>
65
 
66
  <?php
67
+ login_footer($type, $action);
68
  break;
69
 
70
  case 'login' :
105
  <form name="loginform" id="loginform" action="" method="post">
106
  <p>
107
  <label><?php _e('Username') ?><br />
108
+ <input type="text" name="log" id="user_login" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" /></label>
109
  </p>
110
  <p>
111
  <label><?php _e('Password') ?><br />
112
+ <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
113
  </p>
114
  <?php do_action('login_form'); ?>
115
+ <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e('Remember Me'); ?></label></p>
116
  <p class="submit">
117
  <input type="hidden" name="post-from" id="post-from" value="<?php echo $type; ?>" />
118
  <input type="hidden" name="action" id="action" value="login" />
119
+ <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In'); ?>" />
120
  <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
121
  <input type="hidden" name="testcookie" value="1" />
122
  </p>
124
  <?php endif; ?>
125
 
126
  <?php
127
+ login_footer($type, $action);
128
  break;
129
 
130
  endswitch;
includes/wp-login-functions.php CHANGED
@@ -61,20 +61,25 @@ function login_header($message = '', $wp_error = '') {
61
  endif;
62
 
63
  if (!function_exists('login_footer')) :
64
- function login_footer($type = 'page') {
65
  $options = get_option('theme_my_login');
66
- $_GET['action'] = isset($_GET['action']) ? $_GET['action'] : 'login';
 
 
 
 
 
67
  echo '<ul class="links">' . "\n";
68
- if (in_array($_GET['action'], array('register', 'lostpassword')) || $_GET['action'] == 'login' && isset($_GET['checkemail']) && 'registered' != $_GET['checkemail']) {
69
- $url = ($type == 'widget') ? add_query_arg('action', 'login', wp_guess_url()) : site_url('wp-login.php', 'login');
70
  echo '<li><a href="' . $url . '">' . __('Log in') . '</a></li>' . "\n";
71
  }
72
- if (get_option('users_can_register') && $_GET['action'] != 'register') {
73
- $url = ($type == 'widget' && $options['widget_allow_register']) ? add_query_arg('action', 'register', wp_guess_url()) : site_url('wp-login.php?action=register', 'login');
74
  echo '<li><a href="' . $url . '">' . __('Register') . '</a></li>' . "\n";
75
  }
76
- if ($_GET['action'] != 'lostpassword') {
77
- $url = ($type == 'widget' && $options['widget_allow_password']) ? add_query_arg('action', 'lostpassword', wp_guess_url()) : site_url('wp-login.php?action=lostpassword', 'login');
78
  echo '<li><a href="' . $url . '" title="' . __('Password Lost and Found') . '">' . __('Lost your password?') . '</a></li>' . "\n";
79
  }
80
  echo '</ul>' . "\n";
@@ -130,15 +135,20 @@ function retrieve_password() {
130
  $key = wp_generate_password(20, false);
131
  do_action('retrieve_password_key', $user_login, $key);
132
  // Now insert the new md5 key into the db
133
- $wpdb->query($wpdb->prepare("UPDATE $wpdb->users SET user_activation_key = %s WHERE user_login = %s", $key, $user_login));
134
  }
135
  $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
136
  $message .= get_option('siteurl') . "\r\n\r\n";
137
  $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
138
  $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
139
- $message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
140
 
141
- if ( !wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message) )
 
 
 
 
 
142
  die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
143
 
144
  return true;
61
  endif;
62
 
63
  if (!function_exists('login_footer')) :
64
+ function login_footer($type = 'page', $action = '') {
65
  $options = get_option('theme_my_login');
66
+
67
+ if (empty($action))
68
+ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
69
+
70
+ $guess_url = remove_query_arg('loggedout');
71
+
72
  echo '<ul class="links">' . "\n";
73
+ if (in_array($action, array('register', 'lostpassword')) || $action == 'login' && isset($_GET['checkemail']) && 'registered' != $_GET['checkemail']) {
74
+ $url = ($type == 'widget') ? add_query_arg('action', 'login', $guess_url) : site_url('wp-login.php', 'login');
75
  echo '<li><a href="' . $url . '">' . __('Log in') . '</a></li>' . "\n";
76
  }
77
+ if (get_option('users_can_register') && $action != 'register') {
78
+ $url = ($type == 'widget' && $options['widget_allow_register']) ? add_query_arg('action', 'register', $guess_url) : site_url('wp-login.php?action=register', 'login');
79
  echo '<li><a href="' . $url . '">' . __('Register') . '</a></li>' . "\n";
80
  }
81
+ if ($action != 'lostpassword') {
82
+ $url = ($type == 'widget' && $options['widget_allow_password']) ? add_query_arg('action', 'lostpassword', $guess_url) : site_url('wp-login.php?action=lostpassword', 'login');
83
  echo '<li><a href="' . $url . '" title="' . __('Password Lost and Found') . '">' . __('Lost your password?') . '</a></li>' . "\n";
84
  }
85
  echo '</ul>' . "\n";
135
  $key = wp_generate_password(20, false);
136
  do_action('retrieve_password_key', $user_login, $key);
137
  // Now insert the new md5 key into the db
138
+ $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
139
  }
140
  $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
141
  $message .= get_option('siteurl') . "\r\n\r\n";
142
  $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
143
  $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
144
+ $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
145
 
146
+ $title = sprintf(__('[%s] Password Reset'), get_option('blogname'));
147
+
148
+ $title = apply_filters('retrieve_password_title', $title);
149
+ $message = apply_filters('retrieve_password_message', $message, $key);
150
+
151
+ if ( $message && !wp_mail($user_email, $title, $message) )
152
  die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
153
 
154
  return true;
readme.txt CHANGED
@@ -27,6 +27,9 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
27
 
28
  == Changelog ==
29
 
 
 
 
30
  = 3.3 =
31
  * Fixed a bug that disabled error display when GET variable 'loggedout' was set
32
  * Added template tag access
27
 
28
  == Changelog ==
29
 
30
+ = 3.3.1 =
31
+ * Fixed a bug that broke password recovery due to the new system from WP 2.8.4
32
+
33
  = 3.3 =
34
  * Fixed a bug that disabled error display when GET variable 'loggedout' was set
35
  * Added template tag access
theme-my-login.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://www.jfarthing.com/wordpress-plugins/theme-my-login-plugin
5
  Description: Themes the WordPress login, registration and forgot password pages according to your theme.
6
- Version: 3.3
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
@@ -27,7 +27,7 @@ if ($wp_version < '2.6') {
27
  if (!class_exists('ThemeMyLogin')) {
28
  class ThemeMyLogin {
29
 
30
- var $version = '3.3';
31
  var $options = array();
32
  var $permalink = '';
33
 
@@ -197,7 +197,7 @@ if (!class_exists('ThemeMyLogin')) {
197
  return $content;
198
  }
199
 
200
- function DisplayLogin($type = 'page') {
201
  global $login_errors;
202
 
203
  $login_forms = WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-forms.php';
@@ -239,10 +239,11 @@ if (!class_exists('ThemeMyLogin')) {
239
  } return $title;
240
  }
241
 
242
- function TheTitle($title) {
243
  if ($title == 'Login') {
244
 
245
- $action = (empty($_REQUEST['action'])) ? 'login' : $_REQUEST['action'];
 
246
 
247
  switch ($action) {
248
  case 'register':
@@ -308,6 +309,7 @@ if (class_exists('ThemeMyLogin')) {
308
  $defaults['after_widget'] = '</li>';
309
  $defaults['before_title'] = '<h2>';
310
  $defaults['after_title'] = '</h2>';
 
311
  $defaults['show_logged_in'] = 1;
312
  $defaults['show_gravatar'] = 1;
313
  $defaults['gravatar_size'] = 50;
@@ -346,9 +348,9 @@ if (class_exists('ThemeMyLogin')) {
346
  echo '</ul>' . "\n";
347
  echo $args['after_widget'] . "\n";
348
  } elseif (empty($user_ID)) {
349
- $action = (empty($_GET['action'])) ? 'login' : $_GET['action'];
350
- echo $args['before_widget'] . $args['before_title'] . $ThemeMyLogin->TheTitle('Login') . $args['after_title'] . "\n";
351
- echo $ThemeMyLogin->DisplayLogin('widget');
352
  echo $args['after_widget'] . "\n";
353
  }
354
  }
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://www.jfarthing.com/wordpress-plugins/theme-my-login-plugin
5
  Description: Themes the WordPress login, registration and forgot password pages according to your theme.
6
+ Version: 3.3.1
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
27
  if (!class_exists('ThemeMyLogin')) {
28
  class ThemeMyLogin {
29
 
30
+ var $version = '3.3.1';
31
  var $options = array();
32
  var $permalink = '';
33
 
197
  return $content;
198
  }
199
 
200
+ function DisplayLogin($type = 'page', $action = '') {
201
  global $login_errors;
202
 
203
  $login_forms = WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-forms.php';
239
  } return $title;
240
  }
241
 
242
+ function TheTitle($title, $action = '') {
243
  if ($title == 'Login') {
244
 
245
+ if (empty($action))
246
+ $action = (empty($_REQUEST['action'])) ? 'login' : $_REQUEST['action'];
247
 
248
  switch ($action) {
249
  case 'register':
309
  $defaults['after_widget'] = '</li>';
310
  $defaults['before_title'] = '<h2>';
311
  $defaults['after_title'] = '</h2>';
312
+ $defaults['action'] = 'login';
313
  $defaults['show_logged_in'] = 1;
314
  $defaults['show_gravatar'] = 1;
315
  $defaults['gravatar_size'] = 50;
348
  echo '</ul>' . "\n";
349
  echo $args['after_widget'] . "\n";
350
  } elseif (empty($user_ID)) {
351
+ $action = (empty($_GET['action'])) ? (empty($args['action'])) ? '' : $args['action'] : $_GET['action'];
352
+ echo $args['before_widget'] . $args['before_title'] . $ThemeMyLogin->TheTitle('Login', $action) . $args['after_title'] . "\n";
353
+ echo $ThemeMyLogin->DisplayLogin('widget', $action);
354
  echo $args['after_widget'] . "\n";
355
  }
356
  }