Theme My Login - Version 4.3.4

Version Description

  • Added the option to force redirect upon login
Download this release

Release Info

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

Code changes from version 4.3.2 to 4.3.4

admin/admin-redirection.php CHANGED
@@ -1,6 +1,7 @@
1
  <ul class="tabs-nav">
 
2
  <?php
3
- $i = 1;
4
  foreach ($user_roles as $role => $value) {
5
  echo '<li><a href="#fragment-4-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
6
  $i++;
@@ -8,8 +9,21 @@
8
  ?>
9
  </ul>
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <?php
12
- $i1 = 1;
13
  foreach ($user_roles as $role => $value) {
14
  ?>
15
  <div id="fragment-4-<?php echo $i1; ?>" class="tabs-div">
1
  <ul class="tabs-nav">
2
+ <li><a href="#fragment-4-1">General</a></li>
3
  <?php
4
+ $i = 2;
5
  foreach ($user_roles as $role => $value) {
6
  echo '<li><a href="#fragment-4-' . $i . '">' . ucwords($role) . '</a></li>' . "\n";
7
  $i++;
9
  ?>
10
  </ul>
11
 
12
+ <div id="fragment-4-1" class="tabs-div">
13
+ <table class="form-table">
14
+ <tr valign="top">
15
+ <th scope="row"><?php _e('Redirection', 'theme-my-login'); ?></th>
16
+ <td>
17
+ <input name="override_redirect" type="checkbox" id="override_redirect" value="1" <?php if ( $ThemeMyLogin->options['override_redirect'] ) { echo 'checked="checked"'; } ?> />
18
+ <label for="override_redirect"><?php _e('Override All Redirection', 'theme-my-login'); ?></label>
19
+ <p class="description">If checked, the redirection settings specified here will be used regardless of query variables. If unchecked and the "redirect_to" value is set, it will be used instead.</p>
20
+ </td>
21
+ </tr>
22
+ </table>
23
+ </div>
24
+
25
  <?php
26
+ $i1 = 2;
27
  foreach ($user_roles as $role => $value) {
28
  ?>
29
  <div id="fragment-4-<?php echo $i1; ?>" class="tabs-div">
admin/admin.php CHANGED
@@ -42,6 +42,7 @@ if ( $_POST ) {
42
  }
43
  $ThemeMyLogin->options['links'] = $links;
44
 
 
45
  foreach ( $_POST['redirects'] as $role => $data ) {
46
  $redirects[$role] = array('login_url' => $data['login_url']);
47
  }
42
  }
43
  $ThemeMyLogin->options['links'] = $links;
44
 
45
+ $ThemeMyLogin->options['override_redirect'] = isset($_POST['override_redirect']) ? 1 : 0;
46
  foreach ( $_POST['redirects'] as $role => $data ) {
47
  $redirects[$role] = array('login_url' => $data['login_url']);
48
  }
css/theme-my-login.css CHANGED
@@ -19,3 +19,7 @@
19
  .login form label {
20
  display: block;
21
  }
 
 
 
 
19
  .login form label {
20
  display: block;
21
  }
22
+
23
+ .login form p.forgetmenot label {
24
+ display: inline;
25
+ }
readme.txt CHANGED
@@ -39,6 +39,13 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
39
 
40
  == Changelog ==
41
 
 
 
 
 
 
 
 
42
  = 4.3.2 =
43
  * Added the option to redirect unapproved and/or denied users to a custom URL upon login attempt
44
  * Fixed a bug where custom user password is lost if user moderation is enabled
39
 
40
  == Changelog ==
41
 
42
+ = 4.3.4 =
43
+ * Added the option to force redirect upon login
44
+
45
+ = 4.3.3 =
46
+ * Fixed a redirection bug where WordPress is installed in a sub-directory
47
+ * Add CSS style to keep "Remember Me" label inline with checkbox
48
+
49
  = 4.3.2 =
50
  * Added the option to redirect unapproved and/or denied users to a custom URL upon login attempt
51
  * Fixed a bug where custom user password is lost if user moderation is enabled
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: 4.3.2
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
@@ -16,7 +16,7 @@ require_once ('classes/class.wp-login.php');
16
  if (!class_exists('ThemeMyLogin')) {
17
  class ThemeMyLogin {
18
 
19
- var $version = '4.3.2';
20
  var $options = array();
21
  var $permalink = '';
22
  var $instances = 0;
@@ -68,7 +68,7 @@ if (!class_exists('ThemeMyLogin')) {
68
  }
69
 
70
  function Init() {
71
- global $pagenow;
72
 
73
  $this->permalink = get_permalink($this->options['page_id']);
74
 
@@ -86,6 +86,7 @@ if (!class_exists('ThemeMyLogin')) {
86
  if ( $this->options['use_css'] )
87
  wp_enqueue_style('theme-my-login', plugins_url('/theme-my-login/css/theme-my-login.css'));
88
 
 
89
  }
90
 
91
  function AdminInit() {
@@ -108,8 +109,8 @@ if (!class_exists('ThemeMyLogin')) {
108
  wp_deregister_script('jquery-ui-core');
109
  wp_deregister_script('jquery-ui-tabs');
110
  wp_enqueue_script('jquery', plugins_url('/theme-my-login/js/jquery/jquery.js'), false, '1.7.2');
111
- wp_enquque_script('jquery-ui-core', plugins_url('/theme-my-login/js/jquery/ui.core.js'), array('jquery'), '1.7.2');
112
- wp_enquque_script('jquery-ui-tabs', plugins_url('/theme-my-login/js/jquery/ui.tabs.js'), array('jquery', 'jquery-ui-core'), '1.7.2');
113
  }
114
 
115
  wp_enqueue_style('theme-my-login-admin', plugins_url('/theme-my-login/css/theme-my-login-admin.css'));
@@ -246,16 +247,13 @@ if (!class_exists('ThemeMyLogin')) {
246
  }
247
 
248
  function TemplateRedirect() {
249
- global $WPLogin;
250
-
251
  if ( is_page($this->options['page_id']) ) {
252
  $action = ( isset($_GET['action']) ) ? $_GET['action'] : '';
253
  if ( is_user_logged_in() && 'logout' != $action ) {
254
- wp_redirect(get_option('siteurl'));
255
  exit();
256
  }
257
  }
258
- $WPLogin = new WPLogin('theme-my-login', $this->options);
259
  }
260
 
261
  function RegisterForm($instance) {
@@ -395,29 +393,35 @@ if (!class_exists('ThemeMyLogin')) {
395
 
396
  function LoginRedirect($redirect_to, $request, $user) {
397
  global $pagenow;
398
-
399
  $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
400
  $self = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
401
-
402
  if ( empty($redirect_to) || admin_url() == $redirect_to) {
403
  if ( empty($request) )
404
  $redirect_to = ( 'wp-login.php' == $pagenow ) ? $_SERVER['HTTP_REFERER'] : $self;
405
  else
406
  $redirect_to = $request;
407
  }
408
-
409
  if ( is_object($user) && !is_wp_error($user) ) {
410
  $user_role = reset($user->roles);
411
  $redirects = $this->options['redirects'];
412
- if ( '' != $redirects[$user_role]['login_url'] )
413
- $redirect_to = $redirects[$user_role]['login_url'];
 
 
414
  }
 
415
  return $redirect_to;
416
  }
417
 
418
  function SiteURL($url, $path) {
419
  global $wp_rewrite;
420
 
 
 
 
421
  if ( !empty($this->options['page_id']) ) {
422
  if ( preg_match('/wp-login.php/', $url) ) {
423
  $parsed_url = parse_url($url);
@@ -425,6 +429,9 @@ if (!class_exists('ThemeMyLogin')) {
425
  $url = $wp_rewrite->using_permalinks() ? $this->permalink.'?'.$parsed_url['query'] : $this->permalink.'&'.$parsed_url['query'];
426
  else
427
  $url = $this->permalink;
 
 
 
428
  }
429
  }
430
  return $url;
@@ -541,6 +548,7 @@ if (!class_exists('ThemeMyLogin')) {
541
  $this->options['email_from_name'] = '';
542
  $this->options['email_content_type'] = 'text/plain';
543
  $this->options['use_css'] = 1;
 
544
 
545
  // Titles
546
  $this->options['welcome_title'] = __('Welcome') . ', %display_name%';
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: 4.3.4
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
16
  if (!class_exists('ThemeMyLogin')) {
17
  class ThemeMyLogin {
18
 
19
+ var $version = '4.3.4';
20
  var $options = array();
21
  var $permalink = '';
22
  var $instances = 0;
68
  }
69
 
70
  function Init() {
71
+ global $WPLogin, $pagenow;
72
 
73
  $this->permalink = get_permalink($this->options['page_id']);
74
 
86
  if ( $this->options['use_css'] )
87
  wp_enqueue_style('theme-my-login', plugins_url('/theme-my-login/css/theme-my-login.css'));
88
 
89
+ $WPLogin = new WPLogin('theme-my-login', $this->options);
90
  }
91
 
92
  function AdminInit() {
109
  wp_deregister_script('jquery-ui-core');
110
  wp_deregister_script('jquery-ui-tabs');
111
  wp_enqueue_script('jquery', plugins_url('/theme-my-login/js/jquery/jquery.js'), false, '1.7.2');
112
+ wp_enqueue_script('jquery-ui-core', plugins_url('/theme-my-login/js/jquery/ui.core.js'), array('jquery'), '1.7.2');
113
+ wp_enqueue_script('jquery-ui-tabs', plugins_url('/theme-my-login/js/jquery/ui.tabs.js'), array('jquery', 'jquery-ui-core'), '1.7.2');
114
  }
115
 
116
  wp_enqueue_style('theme-my-login-admin', plugins_url('/theme-my-login/css/theme-my-login-admin.css'));
247
  }
248
 
249
  function TemplateRedirect() {
 
 
250
  if ( is_page($this->options['page_id']) ) {
251
  $action = ( isset($_GET['action']) ) ? $_GET['action'] : '';
252
  if ( is_user_logged_in() && 'logout' != $action ) {
253
+ wp_redirect(get_option('home'));
254
  exit();
255
  }
256
  }
 
257
  }
258
 
259
  function RegisterForm($instance) {
393
 
394
  function LoginRedirect($redirect_to, $request, $user) {
395
  global $pagenow;
396
+
397
  $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
398
  $self = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
399
+
400
  if ( empty($redirect_to) || admin_url() == $redirect_to) {
401
  if ( empty($request) )
402
  $redirect_to = ( 'wp-login.php' == $pagenow ) ? $_SERVER['HTTP_REFERER'] : $self;
403
  else
404
  $redirect_to = $request;
405
  }
406
+
407
  if ( is_object($user) && !is_wp_error($user) ) {
408
  $user_role = reset($user->roles);
409
  $redirects = $this->options['redirects'];
410
+ if ( '' != $redirects[$user_role]['login_url'] ) {
411
+ if ( $this->options['override_redirect'] )
412
+ return $redirects[$user_role]['login_url'];
413
+ }
414
  }
415
+
416
  return $redirect_to;
417
  }
418
 
419
  function SiteURL($url, $path) {
420
  global $wp_rewrite;
421
 
422
+ $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
423
+ $self = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
424
+
425
  if ( !empty($this->options['page_id']) ) {
426
  if ( preg_match('/wp-login.php/', $url) ) {
427
  $parsed_url = parse_url($url);
429
  $url = $wp_rewrite->using_permalinks() ? $this->permalink.'?'.$parsed_url['query'] : $this->permalink.'&'.$parsed_url['query'];
430
  else
431
  $url = $this->permalink;
432
+
433
+ $self = remove_query_arg('redirect_to');
434
+ $url = add_query_arg('redirect_to', $self, $url);
435
  }
436
  }
437
  return $url;
548
  $this->options['email_from_name'] = '';
549
  $this->options['email_content_type'] = 'text/plain';
550
  $this->options['use_css'] = 1;
551
+ $this->options['override_redirect'] = 1;
552
 
553
  // Titles
554
  $this->options['welcome_title'] = __('Welcome') . ', %display_name%';