Theme My Login - Version 3.3

Version Description

  • Fixed a bug that disabled error display when GET variable 'loggedout' was set
  • Added template tag access
Download this release

Release Info

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

Code changes from version 3.2.8 to 3.3

includes/admin-page.php CHANGED
@@ -36,7 +36,7 @@ $profile_url = $this->GetOption('widget_profile_url');
36
 
37
  ?>
38
 
39
- <div class="updated" style="background:aliceblue; border:1px solid lightblue">
40
  <p><?php _e('If you like this plugin, please help keep it up to date by <a href="http://www.jfarthing.com/donate">donating through PayPal</a>!', 'theme-my-login'); ?></p>
41
  </div>
42
 
36
 
37
  ?>
38
 
39
+ <div class="updated" style="background:#f0f8ff; border:1px solid #addae6">
40
  <p><?php _e('If you like this plugin, please help keep it up to date by <a href="http://www.jfarthing.com/donate">donating through PayPal</a>!', 'theme-my-login'); ?></p>
41
  </div>
42
 
includes/widget-new.php CHANGED
@@ -90,9 +90,9 @@ class ThemeMyLoginWidget extends WP_Widget {
90
  $defaults['gravatar_size'] = 50;
91
  foreach ($user_roles as $role => $value) {
92
  $defaults['dashboard_link_' . $role] = 1;
93
- $defaults['dashboard_url_' . $role] = 'wp-admin/';
94
  $defaults['profile_link_' . $role] = 1;
95
- $defaults['profile_url_' . $role] = 'wp-admin/profile.php';
96
  }
97
  $instance = wp_parse_args( (array) $instance, (array) $defaults );
98
 
90
  $defaults['gravatar_size'] = 50;
91
  foreach ($user_roles as $role => $value) {
92
  $defaults['dashboard_link_' . $role] = 1;
93
+ //$defaults['dashboard_url_' . $role] = 'wp-admin/';
94
  $defaults['profile_link_' . $role] = 1;
95
+ //$defaults['profile_url_' . $role] = 'wp-admin/profile.php';
96
  }
97
  $instance = wp_parse_args( (array) $instance, (array) $defaults );
98
 
includes/wp-login-actions.php CHANGED
@@ -100,6 +100,9 @@ case 'register' :
100
  case 'login' :
101
  $secure_cookie = '';
102
 
 
 
 
103
  // If the user wants ssl but the session is not ssl, force a secure cookie.
104
  if ( !empty($_POST['log']) && !force_ssl_admin() ) {
105
  $user_name = sanitize_user($_POST['log']);
100
  case 'login' :
101
  $secure_cookie = '';
102
 
103
+ if (isset($_GET['loggedout']))
104
+ unset($_GET['loggedout']);
105
+
106
  // If the user wants ssl but the session is not ssl, force a secure cookie.
107
  if ( !empty($_POST['log']) && !force_ssl_admin() ) {
108
  $user_name = sanitize_user($_POST['log']);
includes/wp-login-functions.php CHANGED
@@ -56,6 +56,7 @@ function login_header($message = '', $wp_error = '') {
56
  if ( !empty($messages) )
57
  echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
58
  }
 
59
  }
60
  endif;
61
 
56
  if ( !empty($messages) )
57
  echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
58
  }
59
+ $error = '';
60
  }
61
  endif;
62
 
readme.txt CHANGED
@@ -27,6 +27,10 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
27
 
28
  == Changelog ==
29
 
 
 
 
 
30
  = 3.2.8 =
31
  * Fixed a security exploit regarding admin password reset addressed in WordPress 2.8.4
32
 
27
 
28
  == Changelog ==
29
 
30
+ = 3.3 =
31
+ * Fixed a bug that disabled error display when GET variable 'loggedout' was set
32
+ * Added template tag access
33
+
34
  = 3.2.8 =
35
  * Fixed a security exploit regarding admin password reset addressed in WordPress 2.8.4
36
 
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: 3.2.8
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
@@ -11,7 +11,7 @@ Text Domain: theme-my-login
11
 
12
  global $wp_version;
13
 
14
- if ($wp_version < '2.7') {
15
  if ( !defined('WP_CONTENT_DIR') )
16
  define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
17
  if ( !defined('WP_CONTENT_URL') )
@@ -27,7 +27,7 @@ if ($wp_version < '2.7') {
27
  if (!class_exists('ThemeMyLogin')) {
28
  class ThemeMyLogin {
29
 
30
- var $version = '3.2.8';
31
  var $options = array();
32
  var $permalink = '';
33
 
@@ -100,14 +100,20 @@ if (!class_exists('ThemeMyLogin')) {
100
  $this->options['widget_show_logged_in'] = 1;
101
  $this->options['widget_show_gravatar'] = 1;
102
  $this->options['widget_gravatar_size'] = 50;
103
- $this->options['widget_dashboard_link'] = array('subscriber' => 1, 'contributor' => 1, 'author' => 1, 'editor' => 1, 'administrator' => 1);
104
- $this->options['widget_profile_link'] = array('subscriber' => 1, 'contributor' => 1, 'author' => 1, 'editor' => 1, 'administrator' => 1);
105
 
106
- $user_roles = array('subscriber', 'contributor', 'author', 'editor', 'administrator');
107
- foreach ($user_roles as $role) {
 
 
 
 
 
 
108
  $dashboard_url[$role] = '';
109
  $profile_url[$role] = '';
110
  }
 
 
111
  $this->options['widget_dashboard_url'] = $dashboard_url;
112
  $this->options['widget_profile_url'] = $profile_url;
113
  }
@@ -183,6 +189,8 @@ if (!class_exists('ThemeMyLogin')) {
183
  }
184
 
185
  function TheContent($content) {
 
 
186
  if (strpos($content, '[theme-my-login]') !== false)
187
  return str_replace('[theme-my-login]', $this->DisplayLogin(), $content);
188
  else
@@ -191,24 +199,30 @@ if (!class_exists('ThemeMyLogin')) {
191
 
192
  function DisplayLogin($type = 'page') {
193
  global $login_errors;
194
-
195
- require (WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-forms.php');
 
 
 
 
 
 
 
 
196
  }
197
 
198
  function WPHead() {
199
  echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
200
  echo '<link rel="stylesheet" type="text/css" href="' . WP_PLUGIN_URL . '/theme-my-login/theme-my-login.css" />' . "\n";
201
- echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
202
  do_action('login_head');
203
  }
204
 
205
  function WPTitle($title) {
206
  if ( is_page($this->GetOption('page_id')) ) {
207
 
208
- if (!isset($_GET['action']))
209
- $_GET['action'] = 'login';
210
-
211
- switch ($_GET['action']) {
212
  case 'register':
213
  return str_replace('Login', $this->GetOption('register_title'), $title);
214
  break;
@@ -228,10 +242,9 @@ if (!class_exists('ThemeMyLogin')) {
228
  function TheTitle($title) {
229
  if ($title == 'Login') {
230
 
231
- if (!isset($_GET['action']))
232
- $_GET['action'] = 'login';
233
 
234
- switch ($_GET['action']) {
235
  case 'register':
236
  return $this->GetOption('register_title');
237
  break;
@@ -281,6 +294,64 @@ if (class_exists('ThemeMyLogin')) {
281
  } else {
282
  require (WP_PLUGIN_DIR . '/theme-my-login/includes/widget-old.php');
283
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
 
286
  ?>
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: 3.3
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
11
 
12
  global $wp_version;
13
 
14
+ if ($wp_version < '2.6') {
15
  if ( !defined('WP_CONTENT_DIR') )
16
  define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
17
  if ( !defined('WP_CONTENT_URL') )
27
  if (!class_exists('ThemeMyLogin')) {
28
  class ThemeMyLogin {
29
 
30
+ var $version = '3.3';
31
  var $options = array();
32
  var $permalink = '';
33
 
100
  $this->options['widget_show_logged_in'] = 1;
101
  $this->options['widget_show_gravatar'] = 1;
102
  $this->options['widget_gravatar_size'] = 50;
 
 
103
 
104
+ global $wp_roles;
105
+ if (empty($wp_roles))
106
+ $wp_roles = new WP_Roles();
107
+
108
+ $user_roles = $wp_roles->get_names();
109
+ foreach ($user_roles as $role => $title) {
110
+ $dashboard_link[$role] = 1;
111
+ $profile_link[$role] = 1;
112
  $dashboard_url[$role] = '';
113
  $profile_url[$role] = '';
114
  }
115
+ $this->options['widget_dashboard_link'] = $dashboard_link;
116
+ $this->options['widget_profile_link'] = $profile_link;
117
  $this->options['widget_dashboard_url'] = $dashboard_url;
118
  $this->options['widget_profile_url'] = $profile_url;
119
  }
189
  }
190
 
191
  function TheContent($content) {
192
+ global $login_errors;
193
+
194
  if (strpos($content, '[theme-my-login]') !== false)
195
  return str_replace('[theme-my-login]', $this->DisplayLogin(), $content);
196
  else
199
 
200
  function DisplayLogin($type = 'page') {
201
  global $login_errors;
202
+
203
+ $login_forms = WP_PLUGIN_DIR . '/theme-my-login/includes/wp-login-forms.php';
204
+ if (is_file($login_forms)) {
205
+ ob_start();
206
+ include $login_forms;
207
+ $contents = ob_get_contents();
208
+ ob_end_clean();
209
+ return $contents;
210
+ }
211
+ return false;
212
  }
213
 
214
  function WPHead() {
215
  echo '<!-- Theme My Login Version ' . $this->version . ' -->' . "\n";
216
  echo '<link rel="stylesheet" type="text/css" href="' . WP_PLUGIN_URL . '/theme-my-login/theme-my-login.css" />' . "\n";
 
217
  do_action('login_head');
218
  }
219
 
220
  function WPTitle($title) {
221
  if ( is_page($this->GetOption('page_id')) ) {
222
 
223
+ $action = (empty($_REQUEST['action'])) ? 'login' : $_REQUEST['action'];
224
+
225
+ switch ($action) {
 
226
  case 'register':
227
  return str_replace('Login', $this->GetOption('register_title'), $title);
228
  break;
242
  function TheTitle($title) {
243
  if ($title == 'Login') {
244
 
245
+ $action = (empty($_REQUEST['action'])) ? 'login' : $_REQUEST['action'];
 
246
 
247
+ switch ($action) {
248
  case 'register':
249
  return $this->GetOption('register_title');
250
  break;
294
  } else {
295
  require (WP_PLUGIN_DIR . '/theme-my-login/includes/widget-old.php');
296
  }
297
+
298
+ function theme_my_login($args = array()) {
299
+ global $ThemeMyLogin, $wp_version, $user_ID, $current_user, $login_errors, $wp_roles;
300
+
301
+ if (empty($wp_roles))
302
+ $wp_roles = new WP_Roles();
303
+
304
+ $user_roles = $wp_roles->get_names();
305
+
306
+ //Defaults
307
+ $defaults['before_widget'] = '<li>';
308
+ $defaults['after_widget'] = '</li>';
309
+ $defaults['before_title'] = '<h2>';
310
+ $defaults['after_title'] = '</h2>';
311
+ $defaults['show_logged_in'] = 1;
312
+ $defaults['show_gravatar'] = 1;
313
+ $defaults['gravatar_size'] = 50;
314
+ foreach ($user_roles as $role => $value) {
315
+ $defaults['dashboard_link_' . $role] = 1;
316
+ $defaults['profile_link_' . $role] = 1;
317
+ }
318
+
319
+ $args = wp_parse_args( $args, (array) $defaults );
320
+
321
+ if ($user_ID != '' && $args['show_logged_in']) {
322
+ get_currentuserinfo();
323
+ $user_role = reset($current_user->roles);
324
+ $dashboard_url = $ThemeMyLogin->GetOption('widget_dashboard_url');
325
+ $profile_url = $ThemeMyLogin->GetOption('widget_profile_url');
326
+ $user_dashboard_url = (empty($dashboard_url[$user_role])) ? site_url('wp-admin/', 'admin') : $dashboard_url[$user_role];
327
+ $user_profile_url = (empty($profile_url[$user_role])) ? site_url('wp-admin/profile.php', 'admin') : $profile_url[$user_role];
328
+ echo $args['before_widget'] . $args['before_title'] . __('Welcome', 'theme-my-login') . ', ' . $current_user->display_name . $args['after_title'] . "\n";
329
+ if ($args['show_gravatar']) :
330
+ echo '<div class="theme-my-login-avatar">' . get_avatar( $user_ID, $size = $args['gravatar_size'] ) . '</div>' . "\n";
331
+ endif;
332
+ do_action('theme_my_login_avatar', $current_user);
333
+ echo '<ul class="theme-my-login-links">' . "\n";
334
+ if ($args['dashboard_link_' . $user_role]) :
335
+ echo '<li><a href="' . $user_dashboard_url . '">' . __('Dashboard') . '</a></li>' . "\n";
336
+ endif;
337
+ if ($args['profile_link_' . $user_role]) :
338
+ echo '<li><a href="' . $user_profile_url . '">' . __('Profile') . '</a></li>' . "\n";
339
+ endif;
340
+ do_action('theme_my_login_links', $user_role);
341
+ $redirect = wp_guess_url();
342
+ if (version_compare($wp_version, '2.7', '>='))
343
+ echo '<li><a href="' . wp_logout_url($redirect) . '">' . __('Log Out') . '</a></li>' . "\n";
344
+ else
345
+ echo '<li><a href="' . site_url('wp-login.php?action=logout&redirect_to='.$redirect, 'login') . '">' . __('Log Out') . '</a></li>' . "\n";
346
+ echo '</ul>' . "\n";
347
+ echo $args['after_widget'] . "\n";
348
+ } elseif (empty($user_ID)) {
349
+ $action = (empty($_GET['action'])) ? 'login' : $_GET['action'];
350
+ echo $args['before_widget'] . $args['before_title'] . $ThemeMyLogin->TheTitle('Login') . $args['after_title'] . "\n";
351
+ echo $ThemeMyLogin->DisplayLogin('widget');
352
+ echo $args['after_widget'] . "\n";
353
+ }
354
+ }
355
  }
356
 
357
  ?>