Theme My Login - Version 2.0.7

Version Description

Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.7

includes/admin-page.php CHANGED
@@ -5,11 +5,12 @@ if ( $_POST ) {
5
  die( __('Cheatin’ 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('theme_profile', stripslashes($_POST['theme_profile']));
13
  $this->SetOption('login_title', stripslashes($_POST['login_title']));
14
  $this->SetOption('login_text', stripslashes($_POST['login_text']));
15
  $this->SetOption('register_title', stripslashes($_POST['register_title']));
@@ -30,7 +31,7 @@ if ( $_POST ) {
30
  </div>
31
 
32
  <div class="wrap">
33
- <?php if ( strlen($success) > 0 ) { ?>
34
  <div id="message" class="updated fade">
35
  <p><strong><?php _e("<ul>{$success}</ul>"); ?></strong></p>
36
  </div>
5
  die( __('Cheatin&#8217; huh?') );
6
 
7
  check_admin_referer('tml-settings');
8
+ $chk_uninstall = isset($_POST['chk_uninstall']) ? true : false;
9
+ $theme_profile = isset($_POST['theme_profile']) ? true : false;
10
+ $this->SetOption('chk_uninstall', $chk_uninstall);
11
  $this->SetOption('login_redirect', stripslashes($_POST['login_redirect']));
12
  $this->SetOption('logout_redirect', stripslashes($_POST['logout_redirect']));
13
+ $this->SetOption('theme_profile', $theme_profile);
14
  $this->SetOption('login_title', stripslashes($_POST['login_title']));
15
  $this->SetOption('login_text', stripslashes($_POST['login_text']));
16
  $this->SetOption('register_title', stripslashes($_POST['register_title']));
31
  </div>
32
 
33
  <div class="wrap">
34
+ <?php if ( isset($success) && strlen($success) > 0 ) { ?>
35
  <div id="message" class="updated fade">
36
  <p><strong><?php _e("<ul>{$success}</ul>"); ?></strong></p>
37
  </div>
includes/profile-actions.php CHANGED
@@ -1,16 +1,11 @@
1
  <?php
2
 
3
- global $wp_version;
4
-
5
- if ($wp_version < '2.6')
6
- include 'compat.php';
7
-
8
  require('wp-login-functions.php');
9
  require_once ABSPATH . '/wp-admin/includes/misc.php';
10
  require_once ABSPATH . '/wp-admin/includes/user.php';
11
  require_once ABSPATH . WPINC . '/registration.php';
12
 
13
- if ( !$user_id ) {
14
  $current_user = wp_get_current_user();
15
  $user_id = $current_user->ID;
16
  }
1
  <?php
2
 
 
 
 
 
 
3
  require('wp-login-functions.php');
4
  require_once ABSPATH . '/wp-admin/includes/misc.php';
5
  require_once ABSPATH . '/wp-admin/includes/user.php';
6
  require_once ABSPATH . WPINC . '/registration.php';
7
 
8
+ if ( !isset($user_id) ) {
9
  $current_user = wp_get_current_user();
10
  $user_id = $current_user->ID;
11
  }
includes/profile-form.php CHANGED
@@ -1,21 +1,17 @@
1
  <?php
2
-
3
- global $wp_version;
4
-
5
- if ($wp_version < '2.6')
6
- include 'compat.php';
7
 
8
  require('wp-login-functions.php');
9
  require_once ABSPATH . '/wp-admin/includes/misc.php';
10
  require_once ABSPATH . '/wp-admin/includes/user.php';
11
 
12
- if ( !$user_id ) {
13
  $current_user = wp_get_current_user();
14
  $user_id = $current_user->ID;
15
  }
16
 
17
  wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
18
- $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
 
19
  $user_id = (int) $user_id;
20
 
21
  $profileuser = get_user_to_edit($user_id);
@@ -24,14 +20,14 @@ if ( !current_user_can('edit_user', $user_id) )
24
 
25
  login_header('', $this->errors);
26
 
27
- if ($_GET['updated'] == true) {
28
  echo '<p class="message">Your profile has been updated.</p>';
29
  }
30
  ?>
31
 
32
  <form name="profile" id="your-profile" action="<?php echo ssl_or_not($this->QueryURL().'profile=1') ?>" method="post">
33
  <?php wp_nonce_field('update-user_' . $user_id) ?>
34
- <?php if ( $wp_http_referer ) : ?>
35
  <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
36
  <?php endif; ?>
37
  <p>
1
  <?php
 
 
 
 
 
2
 
3
  require('wp-login-functions.php');
4
  require_once ABSPATH . '/wp-admin/includes/misc.php';
5
  require_once ABSPATH . '/wp-admin/includes/user.php';
6
 
7
+ if ( !isset($user_id) ) {
8
  $current_user = wp_get_current_user();
9
  $user_id = $current_user->ID;
10
  }
11
 
12
  wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
13
+ if (isset($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);
20
 
21
  login_header('', $this->errors);
22
 
23
+ if (isset($_GET['updated']) && $_GET['updated'] == true) {
24
  echo '<p class="message">Your profile has been updated.</p>';
25
  }
26
  ?>
27
 
28
  <form name="profile" id="your-profile" action="<?php echo ssl_or_not($this->QueryURL().'profile=1') ?>" method="post">
29
  <?php wp_nonce_field('update-user_' . $user_id) ?>
30
+ <?php if ( isset($wp_http_referer) ) : ?>
31
  <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
32
  <?php endif; ?>
33
  <p>
includes/wp-login-actions.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
  global $wp_version;
4
-
5
- if ($wp_version < '2.6')
6
- include 'compat.php';
7
 
8
  require('wp-login-functions.php');
9
 
1
  <?php
2
 
3
  global $wp_version;
 
 
 
4
 
5
  require('wp-login-functions.php');
6
 
includes/wp-login-forms.php CHANGED
@@ -1,10 +1,5 @@
1
  <?php
2
 
3
- global $wp_version;
4
-
5
- if ($wp_version < '2.6')
6
- include 'compat.php';
7
-
8
  require('wp-login-functions.php');
9
 
10
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
@@ -75,13 +70,13 @@ default :
75
  if ( isset( $_REQUEST['redirect_to'] ) ) {
76
  $redirect_to = $_REQUEST['redirect_to'];
77
  // Redirect to https if user wants ssl
78
- if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
79
  $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
80
  } else {
81
  $redirect_to = $this->GetOption('login_redirect');
82
  }
83
 
84
- $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
85
 
86
  // Clear errors if loggedout is set.
87
  if ( !empty($_GET['loggedout']) )
@@ -107,7 +102,7 @@ default :
107
  <form name="loginform" id="loginform" action="<?php echo ssl_or_not($this->QueryURL().'action=login') ?>" method="post">
108
  <p>
109
  <label><?php _e('Username') ?><br />
110
- <input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="20" tabindex="10" /></label>
111
  </p>
112
  <p>
113
  <label><?php _e('Password') ?><br />
1
  <?php
2
 
 
 
 
 
 
3
  require('wp-login-functions.php');
4
 
5
  $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
70
  if ( isset( $_REQUEST['redirect_to'] ) ) {
71
  $redirect_to = $_REQUEST['redirect_to'];
72
  // Redirect to https if user wants ssl
73
+ if ( isset($secure_cookie) && false !== strpos($redirect_to, 'wp-admin') )
74
  $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
75
  } else {
76
  $redirect_to = $this->GetOption('login_redirect');
77
  }
78
 
79
+ //$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
80
 
81
  // Clear errors if loggedout is set.
82
  if ( !empty($_GET['loggedout']) )
102
  <form name="loginform" id="loginform" action="<?php echo ssl_or_not($this->QueryURL().'action=login') ?>" method="post">
103
  <p>
104
  <label><?php _e('Username') ?><br />
105
+ <input type="text" name="log" id="user_login" class="input" value="<?php echo isset($user_login) ? $user_login : ''; ?>" size="20" tabindex="10" /></label>
106
  </p>
107
  <p>
108
  <label><?php _e('Password') ?><br />
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.6
8
 
9
  This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
10
 
@@ -59,4 +59,5 @@ Now you can save your changes and go test out your new themed login and registra
59
  * 2.0.3 - 2009-04-02 - Fixed various reported bugs and cleaned up code
60
  * 2.0.4 - 2009-04-03 - Fixed a bug regarding relative URL's in redirection
61
  * 2.0.5 - 2009-04-04 - Fixed a bug with default redirection and hid the login form from logged in users
62
- * 2.0.6 - 2009-04-08 - Added the option to turn on/off subscriber profile theming
 
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.7
8
 
9
  This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
10
 
59
  * 2.0.3 - 2009-04-02 - Fixed various reported bugs and cleaned up code
60
  * 2.0.4 - 2009-04-03 - Fixed a bug regarding relative URL's in redirection
61
  * 2.0.5 - 2009-04-04 - Fixed a bug with default redirection and hid the login form from logged in users
62
+ * 2.0.6 - 2009-04-08 - Added the option to turn on/off subscriber profile theming
63
+ * 2.0.7 - 2009-04-10 - Fixed a bug that broke the Featured Content plugin
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: 2.0.6
7
  Author: Jae Dub
8
  Author URI: http://webdesign.jaedub.com
9
 
@@ -35,11 +35,20 @@ Version History
35
  Fixed a bug with default redirection and hid the login form from logged in users
36
  2.0.6 - 2009-04-08
37
  Added the option to turn on/off subscriber profile theming
 
 
38
  */
39
 
 
 
 
 
 
 
40
  if (!class_exists('ThemeMyLogin')) {
41
  class ThemeMyLogin {
42
 
 
43
  var $options = array();
44
  var $errors = '';
45
 
@@ -53,7 +62,7 @@ if (!class_exists('ThemeMyLogin')) {
53
 
54
  add_action('admin_menu', array(&$this, 'AddAdminPage'));
55
  add_action('init', array(&$this, 'Init'));
56
- add_action('init', array(&$this, 'ReInit'));
57
 
58
  add_filter('wp_head', array(&$this, 'WPHead'));
59
  add_filter('wp_title', array(&$this, 'WPTitle'));
@@ -63,12 +72,9 @@ if (!class_exists('ThemeMyLogin')) {
63
  }
64
 
65
  function Activate() {
66
- if (get_option('tml_options'))
67
- delete_option('tml_options');
68
-
69
  $theme_my_login = get_page_by_title('Login');
70
-
71
- $insert = array(
72
  'post_title' => 'Login',
73
  'post_status' => 'publish',
74
  'post_type' => 'page',
@@ -77,15 +83,8 @@ if (!class_exists('ThemeMyLogin')) {
77
  'comment_status' => 'closed',
78
  'ping_status' => 'closed'
79
  );
80
-
81
- if (!$theme_my_login) {
82
- $theme_my_login = wp_insert_post($insert);
83
- $page_id = $theme_my_login;
84
- } else {
85
- $insert['ID'] = $theme_my_login->ID;
86
- wp_update_post($insert);
87
- $page_id = $theme_my_login->ID;
88
- }
89
 
90
  if ($this->GetOption('login_redirect') == 'wp-admin/')
91
  $this->SetOption('login_redirect', admin_url());
@@ -106,6 +105,7 @@ if (!class_exists('ThemeMyLogin')) {
106
  # Sets up default options
107
  function InitOptions() {
108
  $this->options['chk_uninstall'] = 0;
 
109
  $this->options['page_id'] = '0';
110
  $this->options['login_redirect'] = admin_url();
111
  $this->options['logout_redirect'] = site_url('wp-login.php?loggedout=true', 'login');
@@ -216,19 +216,32 @@ if (!class_exists('ThemeMyLogin')) {
216
  wp_safe_redirect($redirect_to);
217
  exit;
218
  break;
 
 
 
 
 
 
 
 
219
  }
220
  }
221
 
222
- function ReInit() {
223
- if ($this->GetOption('theme_profile') && $_GET['profile'] && $_REQUEST['action'] == 'update' && is_user_logged_in())
224
- include 'includes/profile-actions.php';
225
- else
226
- include 'includes/wp-login-actions.php';
 
 
 
 
 
227
  }
228
 
229
  function TheContent($content) {
230
  if (strpos($content, '[theme-my-login]') !== false) {
231
- if ($this->GetOption('theme_profile') && $_GET['profile'] && is_user_logged_in())
232
  return $this->DisplayProfile();
233
  else
234
  return $this->DisplayLogin();
@@ -246,14 +259,15 @@ if (!class_exists('ThemeMyLogin')) {
246
  }
247
 
248
  function WPHead() {
249
- echo '<!--Theme My Login Version ' . $this->version . '-->';
250
  }
251
 
252
  function WPTitle($title) {
253
  if (is_page($this->GetOption('page_id'))) {
254
- if ($_GET['profile'] && is_user_logged_in())
255
  return str_replace('%blogname%', get_option('blogname'), $this->GetOption('profile_title'));
256
 
 
257
  switch ($_GET['action']) {
258
  case 'register':
259
  return str_replace('%blogname%', get_option('blogname'), $this->GetOption('register_title'));
@@ -268,14 +282,16 @@ if (!class_exists('ThemeMyLogin')) {
268
  default:
269
  return str_replace('%blogname%', get_option('blogname'), $this->GetOption('login_title'));
270
  }
 
271
  } return $title;
272
  }
273
 
274
  function TheTitle($title) {
275
  if ($title == 'Login') {
276
- if ($_GET['profile'] && is_user_logged_in())
277
  return $this->GetOption('profile_text');
278
 
 
279
  switch ($_GET['action']) {
280
  case 'register':
281
  return $this->GetOption('register_text');
@@ -290,6 +306,7 @@ if (!class_exists('ThemeMyLogin')) {
290
  default:
291
  return $this->GetOption('login_text');
292
  }
 
293
  } return $title;
294
  }
295
 
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
7
  Author: Jae Dub
8
  Author URI: http://webdesign.jaedub.com
9
 
35
  Fixed a bug with default redirection and hid the login form from logged in users
36
  2.0.6 - 2009-04-08
37
  Added the option to turn on/off subscriber profile theming
38
+ 2.0.7 - 2009-04-10
39
+ Fixed a bug that broke the Featured Content plugin
40
  */
41
 
42
+
43
+ global $wp_version;
44
+
45
+ if ($wp_version < '2.6')
46
+ include 'includes/compat.php';
47
+
48
  if (!class_exists('ThemeMyLogin')) {
49
  class ThemeMyLogin {
50
 
51
+ var $version = '2.0.7';
52
  var $options = array();
53
  var $errors = '';
54
 
62
 
63
  add_action('admin_menu', array(&$this, 'AddAdminPage'));
64
  add_action('init', array(&$this, 'Init'));
65
+ add_action('parse_request', array(&$this, 'ParseRequest'));
66
 
67
  add_filter('wp_head', array(&$this, 'WPHead'));
68
  add_filter('wp_title', array(&$this, 'WPTitle'));
72
  }
73
 
74
  function Activate() {
 
 
 
75
  $theme_my_login = get_page_by_title('Login');
76
+ if ( !$theme_my_login ) {
77
+ $insert = array(
78
  'post_title' => 'Login',
79
  'post_status' => 'publish',
80
  'post_type' => 'page',
83
  'comment_status' => 'closed',
84
  'ping_status' => 'closed'
85
  );
86
+ $page_id = wp_insert_post($insert);
87
+ } else $page_id = $theme_my_login->ID;
 
 
 
 
 
 
 
88
 
89
  if ($this->GetOption('login_redirect') == 'wp-admin/')
90
  $this->SetOption('login_redirect', admin_url());
105
  # Sets up default options
106
  function InitOptions() {
107
  $this->options['chk_uninstall'] = 0;
108
+ $this->options['version'] = $this->version;
109
  $this->options['page_id'] = '0';
110
  $this->options['login_redirect'] = admin_url();
111
  $this->options['logout_redirect'] = site_url('wp-login.php?loggedout=true', 'login');
216
  wp_safe_redirect($redirect_to);
217
  exit;
218
  break;
219
+ case 'profile.php':
220
+ if ( $this->GetOption('theme_profile') && is_user_logged_in() && current_user_can('edit_posts') === false && !isset($_POST['from']) && $_POST['from'] != 'profile' ) {
221
+ $_GET['profile'] = true;
222
+ $redirect_to = $this->ArgURL($permalink, $_GET);
223
+ wp_safe_redirect($redirect_to);
224
+ exit;
225
+ }
226
+ break;
227
  }
228
  }
229
 
230
+ function ParseRequest() {
231
+ global $wp;
232
+ $page_id = isset($wp->query_vars['page_id']) ? $wp->query_vars['page_id'] : false;
233
+
234
+ if ($this->GetOption('page_id') == $page_id) {
235
+ if ($this->GetOption('theme_profile') && isset($_GET['profile']) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'update' && is_user_logged_in())
236
+ include 'includes/profile-actions.php';
237
+ else
238
+ include 'includes/wp-login-actions.php';
239
+ }
240
  }
241
 
242
  function TheContent($content) {
243
  if (strpos($content, '[theme-my-login]') !== false) {
244
+ if ($this->GetOption('theme_profile') && isset($_GET['profile']) && is_user_logged_in())
245
  return $this->DisplayProfile();
246
  else
247
  return $this->DisplayLogin();
259
  }
260
 
261
  function WPHead() {
262
+ echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
263
  }
264
 
265
  function WPTitle($title) {
266
  if (is_page($this->GetOption('page_id'))) {
267
+ if (isset($_GET['profile']) && is_user_logged_in())
268
  return str_replace('%blogname%', get_option('blogname'), $this->GetOption('profile_title'));
269
 
270
+ if (isset($_GET['action'])) :
271
  switch ($_GET['action']) {
272
  case 'register':
273
  return str_replace('%blogname%', get_option('blogname'), $this->GetOption('register_title'));
282
  default:
283
  return str_replace('%blogname%', get_option('blogname'), $this->GetOption('login_title'));
284
  }
285
+ endif;
286
  } return $title;
287
  }
288
 
289
  function TheTitle($title) {
290
  if ($title == 'Login') {
291
+ if (isset($_GET['profile']) && is_user_logged_in())
292
  return $this->GetOption('profile_text');
293
 
294
+ if (isset($_GET['action'])) :
295
  switch ($_GET['action']) {
296
  case 'register':
297
  return $this->GetOption('register_text');
306
  default:
307
  return $this->GetOption('login_text');
308
  }
309
+ endif;
310
  } return $title;
311
  }
312