Theme My Login - Version 5.1.5

Version Description

  • Fix blank page redirect bug
Download this release

Release Info

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

Code changes from version 5.1.4 to 5.1.5

includes/hook-functions.php CHANGED
@@ -71,6 +71,21 @@ function wdbj_tml_page_link($link, $id) {
71
  return $link;
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  function wdbj_tml_shortcode($atts = '') {
75
  require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php' );
76
 
71
  return $link;
72
  }
73
 
74
+ function wdbj_tml_setup_nav_menu_item($menu_item) {
75
+ if ( 'page' == $menu_item->object ) {
76
+ $page_id = wdbj_tml_get_option('page_id');
77
+ if ( $page_id == $menu_item->object_id ) {
78
+ if ( is_user_logged_in() ) {
79
+ $menu_item->title = __('Log Out', 'theme-my-login');
80
+ $menu_item->url = wp_nonce_url(add_query_arg('action', 'logout', get_page_link($page_id)), 'log-out');
81
+ } else {
82
+ $menu_item->title = __('Log In', 'theme-my-login');
83
+ }
84
+ }
85
+ }
86
+ return $menu_item;
87
+ }
88
+
89
  function wdbj_tml_shortcode($atts = '') {
90
  require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php' );
91
 
modules/custom-redirection/includes/hook-functions.php CHANGED
@@ -15,57 +15,67 @@ function wdbj_tml_custom_redirect_login($redirect_to, $request, $user) {
15
  // Bailout if this isn't a login
16
  if ( 'POST' != $_SERVER['REQUEST_METHOD'] )
17
  return $redirect_to;
18
-
19
- $orig_redirect = $redirect_to;
20
-
21
- // Determine the correct referer
22
- $http_referer = isset($_REQUEST['_wp_original_http_referer']) ? $_REQUEST['_wp_original_http_referer'] : $_SERVER['HTTP_REFERER'];
23
-
24
  // User is logged in
25
  if ( is_object($user) && !is_wp_error($user) ) {
26
  $user_role = reset($user->roles);
27
  $redirection = wdbj_tml_get_option('redirection', $user_role);
28
- if ( 'default' == $redirection['login_type'] )
29
- $redirect_to = $orig_redirect;
30
- elseif ( 'referer' == $redirection['login_type'] )
31
- $redirect_to = $http_referer;
32
- else {
33
- $redirect_to = $redirection['login_url'];
 
 
 
34
  // Allow a few user specific variables
35
  $replace = array('%user_id%' => $user->ID, '%user_login%' => $user->user_login);
36
- $redirect_to = str_replace(array_keys($replace), array_values($replace), $redirect_to);
37
  }
 
 
 
38
  }
39
 
40
- if ( isset($request) && admin_url() != $request )
41
- $redirect_to = $request;
 
42
 
43
  return $redirect_to;
44
  }
45
 
46
  function wdbj_tml_custom_redirect_logout($redirect_to, $request, $user) {
47
 
48
- $orig_redirect = $redirect_to;
49
-
50
- // Determine the correct referer
51
- $http_referer = isset($_REQUEST['_wp_original_http_referer']) ? $_REQUEST['_wp_original_http_referer'] : $_SERVER['HTTP_REFERER'];
52
- $http_referer = remove_query_arg(array('instance', 'action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key', '_wpnonce'), $http_referer);
53
 
54
  if ( is_object($user) && !is_wp_error($user) ) {
55
  $user_role = reset($user->roles);
56
  $redirection = wdbj_tml_get_option('redirection', $user_role);
57
- if ( 'default' == $redirection['logout_type'] )
58
- $redirect_to = $orig_redirect;
59
- elseif ( 'referer' == $redirection['logout_type'] )
60
- $redirect_to = $http_referer;
61
- else {
62
- $redirect_to = $redirection['logout_url'];
 
 
 
 
 
63
  // Allow a few user specific variables
64
  $replace = array('%user_id%' => $user->ID, '%user_login%' => $user->user_login);
65
- $redirect_to = str_replace(array_keys($replace), array_values($replace), $redirect_to);
66
  }
67
  }
68
 
 
 
 
 
 
69
  if ( strpos($redirect_to, 'wp-admin') !== false )
70
  $redirect_to = add_query_arg('loggedout', 'true', get_permalink(wdbj_tml_get_option('page_id')));
71
 
15
  // Bailout if this isn't a login
16
  if ( 'POST' != $_SERVER['REQUEST_METHOD'] )
17
  return $redirect_to;
18
+
19
+ $_redirect_to = '';
20
+
 
 
 
21
  // User is logged in
22
  if ( is_object($user) && !is_wp_error($user) ) {
23
  $user_role = reset($user->roles);
24
  $redirection = wdbj_tml_get_option('redirection', $user_role);
25
+ if ( 'default' == $redirection['login_type'] ) {
26
+ // Do nothing
27
+ } elseif ( 'referer' == $redirection['login_type'] ) {
28
+ // Determine the correct referer
29
+ if ( !$http_referer = wp_get_original_referer() )
30
+ $http_referer = wp_get_referer();
31
+ $_redirect_to = $http_referer;
32
+ } else {
33
+ $_redirect_to = $redirection['login_url'];
34
  // Allow a few user specific variables
35
  $replace = array('%user_id%' => $user->ID, '%user_login%' => $user->user_login);
36
+ $_redirect_to = str_replace(array_keys($replace), array_values($replace), $_redirect_to);
37
  }
38
+ // Let requested URL take precedence
39
+ if ( !empty($request) && admin_url() != $request )
40
+ $_redirect_to = $request;
41
  }
42
 
43
+ // Make sure it's not empty!
44
+ if ( !empty($_redirect_to) )
45
+ $redirect_to = $_redirect_to;
46
 
47
  return $redirect_to;
48
  }
49
 
50
  function wdbj_tml_custom_redirect_logout($redirect_to, $request, $user) {
51
 
52
+ $_redirect_to = '';
 
 
 
 
53
 
54
  if ( is_object($user) && !is_wp_error($user) ) {
55
  $user_role = reset($user->roles);
56
  $redirection = wdbj_tml_get_option('redirection', $user_role);
57
+ if ( 'default' == $redirection['logout_type'] ) {
58
+ // Do nothing
59
+ } elseif ( 'referer' == $redirection['logout_type'] ) {
60
+ // Determine the correct referer
61
+ if ( !$http_referer = wp_get_original_referer() )
62
+ $http_referer = wp_get_referer();
63
+ // Clean some args
64
+ $http_referer = remove_query_arg(array('instance', 'action', 'checkemail', 'error', 'loggedout', 'registered', 'redirect_to', 'updated', 'key', '_wpnonce'), $http_referer);
65
+ $_redirect_to = $http_referer;
66
+ } else {
67
+ $_redirect_to = $redirection['logout_url'];
68
  // Allow a few user specific variables
69
  $replace = array('%user_id%' => $user->ID, '%user_login%' => $user->user_login);
70
+ $_redirect_to = str_replace(array_keys($replace), array_values($replace), $_redirect_to);
71
  }
72
  }
73
 
74
+ // Make sure it's not empty!
75
+ if ( !empty($_redirect_to) )
76
+ $redirect_to = $_redirect_to;
77
+
78
+ // Make sure it's not an admin URL
79
  if ( strpos($redirect_to, 'wp-admin') !== false )
80
  $redirect_to = add_query_arg('loggedout', 'true', get_permalink(wdbj_tml_get_option('page_id')));
81
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jfarthing84
3
  Donate link: http://www.jfarthing.com/donate
4
  Tags: widget, login, registration, theme, custom, log in, register, sidebar, gravatar, redirection, e-mail
5
  Requires at least: 2.8
6
- Tested up to: 3.0-RC1
7
- Stable tag: 5.1.4
8
 
9
  Themes the WordPress login pages according to your theme.
10
 
@@ -43,6 +43,9 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
43
 
44
  == Changelog ==
45
 
 
 
 
46
  = 5.1.4 =
47
  * Fix the_title() bug fro WP versions before 3.0 (again)
48
  * Fix undefined is_user_logged_in() bug
3
  Donate link: http://www.jfarthing.com/donate
4
  Tags: widget, login, registration, theme, custom, log in, register, sidebar, gravatar, redirection, e-mail
5
  Requires at least: 2.8
6
+ Tested up to: 3.0
7
+ Stable tag: 5.1.5
8
 
9
  Themes the WordPress login pages according to your theme.
10
 
43
 
44
  == Changelog ==
45
 
46
+ = 5.1.5 =
47
+ * Fix blank page redirect bug
48
+
49
  = 5.1.4 =
50
  * Fix the_title() bug fro WP versions before 3.0 (again)
51
  * Fix undefined is_user_logged_in() bug
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
5
  Description: Themes the WordPress login, registration and forgot password pages according to your theme.
6
- Version: 5.1.4
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
@@ -75,6 +75,8 @@ function wdbj_tml_load() {
75
  add_filter('wp_list_pages_excludes', 'wdbj_tml_list_pages_excludes');
76
  add_filter('wp_list_pages', 'wdbj_tml_list_pages');
77
  add_filter('page_link', 'wdbj_tml_page_link', 10, 2);
 
 
78
 
79
  add_shortcode('theme-my-login-page', 'wdbj_tml_page_shortcode');
80
  add_shortcode('theme-my-login', 'wdbj_tml_shortcode');
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://www.jfarthing.com/wordpress-plugins/theme-my-login
5
  Description: Themes the WordPress login, registration and forgot password pages according to your theme.
6
+ Version: 5.1.5
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
75
  add_filter('wp_list_pages_excludes', 'wdbj_tml_list_pages_excludes');
76
  add_filter('wp_list_pages', 'wdbj_tml_list_pages');
77
  add_filter('page_link', 'wdbj_tml_page_link', 10, 2);
78
+
79
+ add_filter('wp_setup_nav_menu_item', 'wdbj_tml_setup_nav_menu_item');
80
 
81
  add_shortcode('theme-my-login-page', 'wdbj_tml_page_shortcode');
82
  add_shortcode('theme-my-login', 'wdbj_tml_shortcode');