Version Description
- Fix bug that blocked users from entire site once logged in
- PROPERLY display "Log Out" when page is shown in pagelist and logged in
Download this release
Release Info
Developer | jfarthing84 |
Plugin | Theme My Login |
Version | 5.1.1 |
Comparing to | |
See all releases |
Code changes from version 5.1 to 5.1.1
- includes/hook-functions.php +22 -29
- includes/login-actions.php +16 -14
- readme.txt +5 -1
- theme-my-login.php +6 -7
includes/hook-functions.php
CHANGED
@@ -1,13 +1,17 @@
|
|
1 |
<?php
|
2 |
|
3 |
function wdbj_tml_the_title($title, $post_id = '') {
|
4 |
-
$
|
5 |
-
if ( is_admin() && !
|
6 |
return $title;
|
7 |
-
if (
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
}
|
12 |
return $title;
|
13 |
}
|
@@ -35,41 +39,30 @@ function wdbj_tml_site_url($url, $path, $orig_scheme) {
|
|
35 |
}
|
36 |
|
37 |
function wdbj_tml_list_pages_excludes($exclude_array) {
|
|
|
|
|
38 |
if ( !wdbj_tml_get_option('show_page') )
|
39 |
$exclude_array[] = wdbj_tml_get_option('page_id');
|
40 |
return $exclude_array;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
function wdbj_tml_page_link($link, $id) {
|
|
|
|
|
|
|
44 |
if ( $id == wdbj_tml_get_option('page_id') ) {
|
45 |
-
if ( is_user_logged_in() )
|
46 |
$link = wp_nonce_url(add_query_arg('action', 'logout', $link), 'log-out');
|
47 |
}
|
48 |
return $link;
|
49 |
}
|
50 |
|
51 |
-
function wdbj_tml_get_pages($pages, $attributes = '') {
|
52 |
-
$tml_page = wdbj_tml_get_option('page_id');
|
53 |
-
if ( is_admin() && ! is_page($tml_page) )
|
54 |
-
return $pages;
|
55 |
-
|
56 |
-
// Change to logout link if user is logged in
|
57 |
-
add_filter('page_link', 'wdbj_tml_page_link', 10, 2);
|
58 |
-
|
59 |
-
// It sucks there's not really a better way to do this
|
60 |
-
if ( wdbj_tml_get_option('show_page') ) {
|
61 |
-
foreach ( $pages as $key => $page ) {
|
62 |
-
if ( $page->ID == $tml_page ) {
|
63 |
-
if ( is_user_logged_in() )
|
64 |
-
$pages[$key]->post_title = __('Log Out', 'theme-my-login');
|
65 |
-
else
|
66 |
-
$pages[$key]->post_title = __('Log In', 'theme-my-login');
|
67 |
-
}
|
68 |
-
}
|
69 |
-
}
|
70 |
-
return $pages;
|
71 |
-
}
|
72 |
-
|
73 |
function wdbj_tml_shortcode($atts = '') {
|
74 |
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php' );
|
75 |
|
1 |
<?php
|
2 |
|
3 |
function wdbj_tml_the_title($title, $post_id = '') {
|
4 |
+
global $wdbj_tml_doing_pagelist;
|
5 |
+
if ( is_admin() && !defined('IS_PROFILE_PAGE') )
|
6 |
return $title;
|
7 |
+
if ( wdbj_tml_get_option('page_id') == $post_id ) {
|
8 |
+
if ( $wdbj_tml_doing_pagelist ) {
|
9 |
+
$title = is_user_logged_in() ? __('Log Out', 'theme-my-login') : __('Log In', 'theme-my-login');
|
10 |
+
} else {
|
11 |
+
require_once (WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php');
|
12 |
+
$action = ( 'tml-page' == wdbj_tml_get_var('request_instance') ) ? wdbj_tml_get_var('request_action') : 'login';
|
13 |
+
$title = wdbj_tml_get_title($action);
|
14 |
+
}
|
15 |
}
|
16 |
return $title;
|
17 |
}
|
39 |
}
|
40 |
|
41 |
function wdbj_tml_list_pages_excludes($exclude_array) {
|
42 |
+
global $wdbj_tml_doing_pagelist;
|
43 |
+
$wdbj_tml_doing_pagelist = true;
|
44 |
if ( !wdbj_tml_get_option('show_page') )
|
45 |
$exclude_array[] = wdbj_tml_get_option('page_id');
|
46 |
return $exclude_array;
|
47 |
}
|
48 |
|
49 |
+
function wdbj_tml_list_pages($output) {
|
50 |
+
global $wdbj_tml_doing_pagelist;
|
51 |
+
$wdbj_tml_doing_pagelist = false;
|
52 |
+
return $output;
|
53 |
+
}
|
54 |
+
|
55 |
function wdbj_tml_page_link($link, $id) {
|
56 |
+
global $wdbj_tml_doing_pagelist;
|
57 |
+
if ( !$wdbj_tml_doing_pagelist )
|
58 |
+
return $link;
|
59 |
if ( $id == wdbj_tml_get_option('page_id') ) {
|
60 |
+
if ( is_user_logged_in() && ( !isset($_REQUEST['action']) || 'logout' != $_REQUEST['action'] ) )
|
61 |
$link = wp_nonce_url(add_query_arg('action', 'logout', $link), 'log-out');
|
62 |
}
|
63 |
return $link;
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
function wdbj_tml_shortcode($atts = '') {
|
67 |
require_once( WP_PLUGIN_DIR . '/theme-my-login/includes/template-functions.php' );
|
68 |
|
includes/login-actions.php
CHANGED
@@ -121,21 +121,23 @@ switch ( $action ) {
|
|
121 |
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
|
122 |
$secure_cookie = false;
|
123 |
|
124 |
-
|
|
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
139 |
break;
|
140 |
}
|
141 |
|
121 |
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
|
122 |
$secure_cookie = false;
|
123 |
|
124 |
+
if ( $http_post ) {
|
125 |
+
$user = wp_signon('', $secure_cookie);
|
126 |
|
127 |
+
$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
128 |
+
|
129 |
+
wdbj_tml_set_var($redirect_to, 'redirect_to');
|
130 |
+
|
131 |
+
if ( !is_wp_error($user) ) {
|
132 |
+
// If the user can't edit posts, send them to their profile.
|
133 |
+
if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
|
134 |
+
$redirect_to = admin_url('profile.php');
|
135 |
+
wp_safe_redirect($redirect_to);
|
136 |
+
exit();
|
137 |
+
}
|
138 |
+
|
139 |
+
wdbj_tml_set_error($user);
|
140 |
+
}
|
141 |
break;
|
142 |
}
|
143 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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-alpha
|
7 |
-
Stable tag:
|
8 |
|
9 |
Themes the WordPress login pages according to your theme.
|
10 |
|
@@ -43,6 +43,10 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
|
|
46 |
= 5.1 =
|
47 |
* Display "Log Out" when page is shown in pagelist and logged in
|
48 |
* Forward profile.php to themed profile when module is active
|
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-alpha
|
7 |
+
Stable tag: 5.1.1
|
8 |
|
9 |
Themes the WordPress login pages according to your theme.
|
10 |
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 5.1.1 =
|
47 |
+
* Fix bug that blocked users from entire site once logged in
|
48 |
+
* PROPERLY display "Log Out" when page is shown in pagelist and logged in
|
49 |
+
|
50 |
= 5.1 =
|
51 |
* Display "Log Out" when page is shown in pagelist and logged in
|
52 |
* Forward profile.php to themed profile when module is active
|
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
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
@@ -71,11 +71,10 @@ function wdbj_tml_load() {
|
|
71 |
|
72 |
if ( wdbj_tml_get_option('rewrite_links') )
|
73 |
add_filter('site_url', 'wdbj_tml_site_url', 10, 3);
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
add_filter('wp_list_pages_excludes', 'wdbj_tml_list_pages_excludes');
|
79 |
|
80 |
add_shortcode('theme-my-login-page', 'wdbj_tml_page_shortcode');
|
81 |
add_shortcode('theme-my-login', 'wdbj_tml_shortcode');
|
@@ -111,4 +110,4 @@ function theme_my_login($args = '') {
|
|
111 |
echo wdbj_tml_shortcode($args);
|
112 |
}
|
113 |
|
114 |
-
?>
|
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.1
|
7 |
Author: Jeff Farthing
|
8 |
Author URI: http://www.jfarthing.com
|
9 |
Text Domain: theme-my-login
|
71 |
|
72 |
if ( wdbj_tml_get_option('rewrite_links') )
|
73 |
add_filter('site_url', 'wdbj_tml_site_url', 10, 3);
|
74 |
+
|
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');
|
110 |
echo wdbj_tml_shortcode($args);
|
111 |
}
|
112 |
|
113 |
+
?>
|