Theme My Login - Version 5.1.3

Version Description

  • Make Themed Profiles work properly
Download this release

Release Info

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

Code changes from version 5.1.2 to 5.1.3

includes/template-functions.php CHANGED
@@ -54,7 +54,7 @@ function wdbj_tml_display() {
54
  unset($current_instance, $request_instance, $action, $user_links, $link);
55
  $contents = ob_get_contents();
56
  ob_end_clean();
57
- return $contents;
58
  }
59
 
60
  function wdbj_tml_get_display_options() {
54
  unset($current_instance, $request_instance, $action, $user_links, $link);
55
  $contents = ob_get_contents();
56
  ob_end_clean();
57
+ return apply_filters('tml_display', $contents);
58
  }
59
 
60
  function wdbj_tml_get_display_options() {
modules/themed-profiles/includes/hook-functions.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- function wdbj_tml_themed_profiles_site_url($url, $path, $orig_scheme = '') {
4
- global $wp_rewrite, $current_user;
5
-
6
- if ( is_user_logged_in() ) {
7
- if ( strpos($url, 'profile.php') !== false ) {
8
- $orig_url = $url;
9
- $url = add_query_arg('action', 'profile', get_permalink(wdbj_tml_get_option('page_id')));
10
- if ( strpos($orig_url, '?') ) {
11
- $query = substr($orig_url, strpos($orig_url, '?') + 1);
12
- parse_str($query, $r);
13
- $url = add_query_arg($r, $url);
14
- }
15
- }
16
- }
17
- return $url;
18
- }
19
-
20
- function wdbj_tml_themed_profiles_title($title, $action) {
21
- if ( 'profile' == $action && is_user_logged_in() && '' == wdbj_tml_get_var('current_instance', 'instance_id') )
22
- $title = __('Your Profile', 'theme-my-login');
23
- return $title;
24
- }
25
-
26
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/themed-profiles/includes/template-functions.php CHANGED
@@ -5,7 +5,34 @@ function wdbj_tml_themed_profiles_display() {
5
 
6
  $profileuser = get_user_to_edit($current_user->ID);
7
 
8
- wdbj_tml_get_header();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ?>
10
  <form id="your-profile" action="" method="post">
11
  <?php wp_nonce_field('update-user_' . $current_user->ID) ?>
@@ -155,13 +182,15 @@ if ( $show_password_fields ) :
155
  <?php } ?>
156
 
157
  <p class="submit">
158
- <input type="hidden" name="action" value="update" />
159
  <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($current_user->ID); ?>" />
160
  <input type="submit" class="button-primary" value="<?php esc_attr_e('Update Profile'); ?>" name="submit" />
161
  </p>
162
  </form>
163
  </div>
164
  <?php
 
 
 
165
  }
166
 
167
  ?>
5
 
6
  $profileuser = get_user_to_edit($current_user->ID);
7
 
8
+ $wp_error = wdbj_tml_get_var('errors');
9
+ if ( empty($wp_error) )
10
+ $wp_error = new WP_Error();
11
+
12
+ if ( isset($_GET['updated']) && $_GET['updated'] )
13
+ $wp_error->add('profile_updated', __('Profile updated.', 'theme-my-login'), 'message');
14
+
15
+ ob_start();
16
+ ?>
17
+ <div class="login" id="profile">
18
+ <?php
19
+ if ( is_wp_error($wp_error) && $wp_error->get_error_code() ) {
20
+ $errors = '';
21
+ $messages = '';
22
+ foreach ( $wp_error->get_error_codes() as $code ) {
23
+ $severity = $wp_error->get_error_data($code);
24
+ foreach ( $wp_error->get_error_messages($code) as $error ) {
25
+ if ( 'message' == $severity )
26
+ $messages .= ' ' . $error . "<br />\n";
27
+ else
28
+ $errors .= ' ' . $error . "<br />\n";
29
+ }
30
+ }
31
+ if ( !empty($errors) )
32
+ echo '<p class="error">' . apply_filters('login_errors', $errors) . "</p>\n";
33
+ if ( !empty($messages) )
34
+ echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
35
+ }
36
  ?>
37
  <form id="your-profile" action="" method="post">
38
  <?php wp_nonce_field('update-user_' . $current_user->ID) ?>
182
  <?php } ?>
183
 
184
  <p class="submit">
 
185
  <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($current_user->ID); ?>" />
186
  <input type="submit" class="button-primary" value="<?php esc_attr_e('Update Profile'); ?>" name="submit" />
187
  </p>
188
  </form>
189
  </div>
190
  <?php
191
+ $contents = ob_get_contents();
192
+ ob_end_clean();
193
+ return $contents;
194
  }
195
 
196
  ?>
modules/themed-profiles/themed-profiles.php CHANGED
@@ -4,30 +4,29 @@ Plugin Name: Themed Profiles
4
  Description: Enabling this module will initialize and enable themed profiles. There are no other settings for this module.
5
  */
6
 
7
- add_action('tml_load', 'wdbj_tml_themed_profiles_load');
8
- function wdbj_tml_themed_profiles_load() {
9
- include_once( TML_MODULE_DIR . '/themed-profiles/includes/hook-functions.php' );
10
- add_filter('site_url', 'wdbj_tml_themed_profiles_site_url', 10, 3);
11
- add_filter('admin_url', 'wdbj_tml_themed_profiles_site_url', 10, 2);
12
- }
13
-
14
  add_action('tml_init', 'wdbj_tml_themed_profiles_init');
15
  function wdbj_tml_themed_profiles_init() {
 
 
 
 
 
 
 
 
 
16
  global $current_user, $action, $redirect, $profile, $user_id, $wp_http_referer;
17
 
18
- include_once( TML_MODULE_DIR . '/themed-profiles/includes/template-functions.php' );
19
-
20
- if ( ! ( is_user_logged_in() && is_page(wdbj_tml_get_option('page_id')) ) )
21
- return;
22
-
23
- add_filter('tml_title', 'wdbj_tml_themed_profiles_title', 10, 2);
24
 
25
  require_once( ABSPATH . 'wp-admin/includes/misc.php' );
26
  require_once( ABSPATH . 'wp-admin/includes/template.php' );
27
  require_once( ABSPATH . 'wp-admin/includes/user.php' );
28
  require_once( ABSPATH . WPINC . '/registration.php' );
29
 
 
30
  define('WP_ADMIN', true);
 
31
 
32
  wp_enqueue_style('themed-profiles', plugins_url('theme-my-login/modules/themed-profiles/themed-profiles.css'));
33
 
@@ -38,7 +37,7 @@ function wdbj_tml_themed_profiles_init() {
38
 
39
  $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
40
 
41
- if ( 'update' == $action ) {
42
  check_admin_referer('update-user_' . $current_user->ID);
43
 
44
  if ( !current_user_can('edit_user', $current_user->ID) )
@@ -58,7 +57,8 @@ function wdbj_tml_themed_profiles_init() {
58
 
59
  add_filter('the_content', 'wdbj_tml_themed_profiles_content');
60
  function wdbj_tml_themed_profiles_content($content) {
61
- if ( is_page( wdbj_tml_get_option('page_id') ) && is_user_logged_in() && 'profile' == wdbj_tml_get_var('request_action') )
 
62
  return wdbj_tml_themed_profiles_display();
63
  return $content;
64
  }
@@ -74,4 +74,30 @@ function wdbj_tml_themed_profiles_template_redirect() {
74
  }
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  ?>
4
  Description: Enabling this module will initialize and enable themed profiles. There are no other settings for this module.
5
  */
6
 
 
 
 
 
 
 
 
7
  add_action('tml_init', 'wdbj_tml_themed_profiles_init');
8
  function wdbj_tml_themed_profiles_init() {
9
+ if ( is_user_logged_in() && is_page(wdbj_tml_get_option('page_id')) && !( isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('update', 'profile', 'logout')) ) ) {
10
+ $redirect_to = admin_url('profile.php');
11
+ wp_redirect($redirect_to);
12
+ exit;
13
+ }
14
+ }
15
+
16
+ add_action('login_action_profile', 'wdbj_tml_themed_profiles_action');
17
+ function wdbj_tml_themed_profiles_action() {
18
  global $current_user, $action, $redirect, $profile, $user_id, $wp_http_referer;
19
 
20
+ require_once( TML_MODULE_DIR . '/themed-profiles/includes/template-functions.php' );
 
 
 
 
 
21
 
22
  require_once( ABSPATH . 'wp-admin/includes/misc.php' );
23
  require_once( ABSPATH . 'wp-admin/includes/template.php' );
24
  require_once( ABSPATH . 'wp-admin/includes/user.php' );
25
  require_once( ABSPATH . WPINC . '/registration.php' );
26
 
27
+ // Needed to make admin scripts available
28
  define('WP_ADMIN', true);
29
+ define('IS_PROFILE_PAGE', true);
30
 
31
  wp_enqueue_style('themed-profiles', plugins_url('theme-my-login/modules/themed-profiles/themed-profiles.css'));
32
 
37
 
38
  $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
39
 
40
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
41
  check_admin_referer('update-user_' . $current_user->ID);
42
 
43
  if ( !current_user_can('edit_user', $current_user->ID) )
57
 
58
  add_filter('the_content', 'wdbj_tml_themed_profiles_content');
59
  function wdbj_tml_themed_profiles_content($content) {
60
+ $action = wdbj_tml_get_var('request_action');
61
+ if ( is_page( wdbj_tml_get_option('page_id') ) && is_user_logged_in() && ( 'profile' == $action || 'update' == $action ) )
62
  return wdbj_tml_themed_profiles_display();
63
  return $content;
64
  }
74
  }
75
  }
76
 
77
+ add_filter('site_url', 'wdbj_tml_themed_profiles_site_url', 10, 3);
78
+ add_filter('admin_url', 'wdbj_tml_themed_profiles_site_url', 10, 2);
79
+ function wdbj_tml_themed_profiles_site_url($url, $path, $orig_scheme = '') {
80
+ global $wp_rewrite, $current_user;
81
+
82
+ if ( is_user_logged_in() ) {
83
+ if ( strpos($url, 'profile.php') !== false ) {
84
+ $orig_url = $url;
85
+ $url = add_query_arg('action', 'profile', get_permalink(wdbj_tml_get_option('page_id')));
86
+ if ( strpos($orig_url, '?') ) {
87
+ $query = substr($orig_url, strpos($orig_url, '?') + 1);
88
+ parse_str($query, $r);
89
+ $url = add_query_arg($r, $url);
90
+ }
91
+ }
92
+ }
93
+ return $url;
94
+ }
95
+
96
+ add_filter('tml_title', 'wdbj_tml_themed_profiles_title', 10, 2);
97
+ function wdbj_tml_themed_profiles_title($title, $action) {
98
+ if ( ( 'profile' == $action || 'update' == $action ) && is_user_logged_in() && '' == wdbj_tml_get_var('current_instance', 'instance_id') )
99
+ $title = __('Your Profile', 'theme-my-login');
100
+ return $title;
101
+ }
102
+
103
  ?>
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-RC1
7
- Stable tag: 5.1.2
8
 
9
  Themes the WordPress login pages according to your theme.
10
 
@@ -43,6 +43,13 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
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
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.3
8
 
9
  Themes the WordPress login pages according to your theme.
10
 
43
 
44
  == Changelog ==
45
 
46
+ = 5.1.3 =
47
+ * Make Themed Profiles work properly
48
+
49
+ = 5.1.2 =
50
+ * Fix the_title() bug for WP versions before 3.0
51
+ * Fix redirection bug caused by 5.1.1 update
52
+
53
  = 5.1.1 =
54
  * Fix bug that blocked users from entire site once logged in
55
  * PROPERLY display "Log Out" when page is shown in pagelist and logged in
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.2
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
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.3
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login