Theme My Login - Version 4.2

Version Description

  • Added the option to send e-mails in HTML format
  • Fixed a bug that broke custom user role links if all links were deleted
Download this release

Release Info

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

Code changes from version 4.1.2 to 4.2

classes/class.plugin-shell.php CHANGED
@@ -37,6 +37,7 @@ if ( !class_exists('WPPluginShell')) {
37
  var $options;
38
 
39
  var $mail_from;
 
40
 
41
  var $wp_version;
42
 
@@ -60,6 +61,7 @@ if ( !class_exists('WPPluginShell')) {
60
 
61
  $this->AddFilter('wp_mail_from', '_WPMailFrom_');
62
  $this->AddFilter('wp_mail_from_name', '_WPMailFromName_');
 
63
 
64
  $this->ActivateHooks('actions');
65
  $this->ActivateHooks('filters');
@@ -168,6 +170,11 @@ if ( !class_exists('WPPluginShell')) {
168
  $this->mail_from['name'] = $name;
169
  }
170
 
 
 
 
 
 
171
  function _WPHead_() {
172
  if ( version_compare($this->wp_version, '2.6', '<') ) {
173
  if ( is_array($this->styles) && !empty($this->styles) ) {
@@ -265,6 +272,10 @@ if ( !class_exists('WPPluginShell')) {
265
  function _WPMailFromName_($from_name) {
266
  return (empty($this->mail_from['name'])) ? $from_name : $this->mail_from['name'];
267
  }
 
 
 
 
268
 
269
  function _handle_enqueues($type, $to_enqueue) {
270
  if ( is_array($to_enqueue) && !empty($to_enqueue) ) {
37
  var $options;
38
 
39
  var $mail_from;
40
+ var $mail_content_type;
41
 
42
  var $wp_version;
43
 
61
 
62
  $this->AddFilter('wp_mail_from', '_WPMailFrom_');
63
  $this->AddFilter('wp_mail_from_name', '_WPMailFromName_');
64
+ $this->AddFilter('wp_mail_content_type', '_WPMailContentType_');
65
 
66
  $this->ActivateHooks('actions');
67
  $this->ActivateHooks('filters');
170
  $this->mail_from['name'] = $name;
171
  }
172
 
173
+ function SetMailContentType($format) {
174
+ if (!empty($format))
175
+ $this->mail_content_type = $format;
176
+ }
177
+
178
  function _WPHead_() {
179
  if ( version_compare($this->wp_version, '2.6', '<') ) {
180
  if ( is_array($this->styles) && !empty($this->styles) ) {
272
  function _WPMailFromName_($from_name) {
273
  return (empty($this->mail_from['name'])) ? $from_name : $this->mail_from['name'];
274
  }
275
+
276
+ function _WPMailContentType_($format) {
277
+ return (empty($this->mail_content_type)) ? $format : $this->mail_content_type;
278
+ }
279
 
280
  function _handle_enqueues($type, $to_enqueue) {
281
  if ( is_array($to_enqueue) && !empty($to_enqueue) ) {
includes/admin-page.php CHANGED
@@ -14,6 +14,7 @@ if ( $_POST ) {
14
  $ThemeMyLogin->options['general']['page_id'] = (int) $_POST['general']['page_id'];
15
  $ThemeMyLogin->options['general']['from_name'] = stripslashes($_POST['general']['from_name']);
16
  $ThemeMyLogin->options['general']['from_email'] = stripslashes($_POST['general']['from_email']);
 
17
 
18
  $ThemeMyLogin->SetOption('titles', stripslashes_deep($_POST['titles']));
19
  $ThemeMyLogin->SetOption('messages', stripslashes_deep($_POST['messages']));
@@ -75,7 +76,7 @@ $emails = $ThemeMyLogin->GetOption('emails');
75
  </div>
76
  <?php endif; ?>
77
 
78
- <form id="bs-settings" action="" method="post">
79
  <?php wp_nonce_field('theme-my-login-settings'); ?>
80
 
81
  <div id="container" class="tabs">
@@ -218,9 +219,10 @@ $emails = $ThemeMyLogin->GetOption('emails');
218
  <table id="links-<?php echo $role; ?>" class="form-table link-table">
219
  <?php $i2 = 0; ?>
220
  <?php $alt = 'alternate'; ?>
221
- <?php foreach ( $links[$role] as $key => $data ) {
222
- $alt = ('alternate' == $alt) ? '' : 'alternate';
223
- ?>
 
224
  <tr id="link-row-<?php echo $i2; ?>" class="<?php echo $alt; ?>">
225
  <td>
226
  Title<br />
@@ -233,10 +235,23 @@ $emails = $ThemeMyLogin->GetOption('emails');
233
  </p>
234
  </td>
235
  </tr>
236
- <?php
237
  $i2++;
238
  }
239
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  </table>
241
 
242
  </div>
@@ -307,6 +322,15 @@ $emails = $ThemeMyLogin->GetOption('emails');
307
  <input name="general[from_email]" type="text" id="general[from_email]" value="<?php echo htmlspecialchars($ThemeMyLogin->options['general']['from_email']); ?>" class="regular-text" />
308
  </td>
309
  </tr>
 
 
 
 
 
 
 
 
 
310
  </table>
311
  </div>
312
 
@@ -368,5 +392,6 @@ $emails = $ThemeMyLogin->GetOption('emails');
368
  <?php else : ?>
369
  <p><input type="submit" name="Submit" class="button" value="<?php _e('Save Changes'); ?>" /></p>
370
  <?php endif; ?>
 
371
 
372
  </div>
14
  $ThemeMyLogin->options['general']['page_id'] = (int) $_POST['general']['page_id'];
15
  $ThemeMyLogin->options['general']['from_name'] = stripslashes($_POST['general']['from_name']);
16
  $ThemeMyLogin->options['general']['from_email'] = stripslashes($_POST['general']['from_email']);
17
+ $ThemeMyLogin->options['general']['email_format'] = stripslashes($_POST['general']['email_format']);
18
 
19
  $ThemeMyLogin->SetOption('titles', stripslashes_deep($_POST['titles']));
20
  $ThemeMyLogin->SetOption('messages', stripslashes_deep($_POST['messages']));
76
  </div>
77
  <?php endif; ?>
78
 
79
+ <form id="theme-my-login-settings" action="" method="post">
80
  <?php wp_nonce_field('theme-my-login-settings'); ?>
81
 
82
  <div id="container" class="tabs">
219
  <table id="links-<?php echo $role; ?>" class="form-table link-table">
220
  <?php $i2 = 0; ?>
221
  <?php $alt = 'alternate'; ?>
222
+ <?php if ( is_array($links[$role]) ) { ?>
223
+ <?php foreach ( $links[$role] as $key => $data ) {
224
+ $alt = ('alternate' == $alt) ? '' : 'alternate';
225
+ ?>
226
  <tr id="link-row-<?php echo $i2; ?>" class="<?php echo $alt; ?>">
227
  <td>
228
  Title<br />
235
  </p>
236
  </td>
237
  </tr>
238
+ <?php
239
  $i2++;
240
  }
241
+ } else { ?>
242
+ <tr id="link-row-0" class="">
243
+ <td>
244
+ Title<br />
245
+ <input name="links[<?php echo $role; ?>][0][title]" type="text" id="links[<?php echo $role; ?>][0][title]" value="" class="regular-text link-title" /><br />
246
+ URL<br />
247
+ <input name="links[<?php echo $role; ?>][0][url]" type="text" id="links[<?php echo $role; ?>][0][url]" value="" class="extended-text link-url" /><br />
248
+ <p>
249
+ <a class="link remove <?php echo $role; ?>" href="" title="Remove This Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/remove.gif" /></a>
250
+ <a class="link add <?php echo $role; ?>" href="" title="Add Another Link"><img src="<?php echo WP_PLUGIN_URL; ?>/theme-my-login/images/add.gif" /></a>
251
+ </p>
252
+ </td>
253
+ </tr>
254
+ <?php } ?>
255
  </table>
256
 
257
  </div>
322
  <input name="general[from_email]" type="text" id="general[from_email]" value="<?php echo htmlspecialchars($ThemeMyLogin->options['general']['from_email']); ?>" class="regular-text" />
323
  </td>
324
  </tr>
325
+ <tr valign="top">
326
+ <td>
327
+ <label for"general[email_format]"><?php _e('E-mail Format', 'theme-my-login'); ?></label><br />
328
+ <select name="general[email_format]" id="general[email_format]">
329
+ <option value="text/plain"<?php if ('text/plain' == $ThemeMyLogin->options['general']['email_format']) echo ' selected="selected"'; ?>>Plain Text</option>
330
+ <option value="text/html"<?php if ('text/html' == $ThemeMyLogin->options['general']['email_format']) echo ' selected="selected"'; ?>>HTML</option>
331
+ </select>
332
+ </td>
333
+ </tr>
334
  </table>
335
  </div>
336
 
392
  <?php else : ?>
393
  <p><input type="submit" name="Submit" class="button" value="<?php _e('Save Changes'); ?>" /></p>
394
  <?php endif; ?>
395
+ </form>
396
 
397
  </div>
includes/compat.php CHANGED
@@ -48,6 +48,49 @@ function admin_url($path = '') {
48
  }
49
  endif;
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  if ( !function_exists('force_ssl_login') ) :
52
  function force_ssl_login($force = '') {
53
  static $forced;
48
  }
49
  endif;
50
 
51
+ if ( !function_exists('includes_url') ) :
52
+ function includes_url($path = '') {
53
+ $url = site_url() . '/' . WPINC . '/';
54
+
55
+ if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
56
+ $url .= ltrim($path, '/');
57
+
58
+ return $url;
59
+ }
60
+ endif;
61
+
62
+ if ( !function_exists('content_url') ) :
63
+ function content_url($path = '') {
64
+ $scheme = ( is_ssl() ? 'https' : 'http' );
65
+ $url = WP_CONTENT_URL;
66
+ if ( 0 === strpos($url, 'http') ) {
67
+ if ( is_ssl() )
68
+ $url = str_replace( 'http://', "{$scheme}://", $url );
69
+ }
70
+
71
+ if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
72
+ $url .= '/' . ltrim($path, '/');
73
+
74
+ return $url;
75
+ }
76
+ endif;
77
+
78
+ if ( !function_exists('plugin_url') ) :
79
+ function plugins_url($path = '') {
80
+ $scheme = ( is_ssl() ? 'https' : 'http' );
81
+ $url = WP_PLUGIN_URL;
82
+ if ( 0 === strpos($url, 'http') ) {
83
+ if ( is_ssl() )
84
+ $url = str_replace( 'http://', "{$scheme}://", $url );
85
+ }
86
+
87
+ if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
88
+ $url .= '/' . ltrim($path, '/');
89
+
90
+ return $url;
91
+ }
92
+ endif;
93
+
94
  if ( !function_exists('force_ssl_login') ) :
95
  function force_ssl_login($force = '') {
96
  static $forced;
js/{theme-my-login-admin.js.php → theme-my-login-admin.js} RENAMED
@@ -1,11 +1,3 @@
1
- <?php
2
-
3
- $version = ( isset($_GET['ver']) ) ? $_GET['ver'] : '';
4
-
5
- header("content-type: application/x-javascript");
6
-
7
- ?>
8
-
9
  jQuery(document).ready(function($){
10
 
11
  $("#container, #container div").tabs({ fx: { opacity: 'toggle', duration: 'fast' } });
@@ -14,7 +6,8 @@ jQuery(document).ready(function($){
14
  var arr = $(this).attr("class").split(" ");
15
  var action = arr[1];
16
  var role = arr[2];
17
- var count = $("#links-" + role + " tbody>tr").size();
 
18
  if ('add' == action) {
19
  $("#links-" + role + " tbody>tr:last").clone(true).insertAfter("#links-" + role + " tbody>tr:last");
20
  var curclass = $("#links-" + role + " tbody>tr:last").attr("class");
 
 
 
 
 
 
 
 
1
  jQuery(document).ready(function($){
2
 
3
  $("#container, #container div").tabs({ fx: { opacity: 'toggle', duration: 'fast' } });
6
  var arr = $(this).attr("class").split(" ");
7
  var action = arr[1];
8
  var role = arr[2];
9
+ var lastrow = $("#links-" + role + " tbody>tr:last").attr("id");
10
+ var count = Number(lastrow.substring(9, lastrow.length)) + 1;
11
  if ('add' == action) {
12
  $("#links-" + role + " tbody>tr:last").clone(true).insertAfter("#links-" + role + " tbody>tr:last");
13
  var curclass = $("#links-" + role + " tbody>tr:last").attr("class");
readme.txt CHANGED
@@ -21,6 +21,7 @@ This plugin themes the WordPress login, registration and forgot password pages a
21
  * Show gravatar to users who are logged in
22
  * Assign custom links to users who are logged in based on their role
23
  * Customize user emails for registration and/or password recovery
 
24
  * Allow users to set their own password upon registration
25
 
26
 
@@ -37,6 +38,10 @@ None yet. Please visit http://www.jfarthing.com/forum for any support!
37
 
38
  == Changelog ==
39
 
 
 
 
 
40
  = 4.1.2 =
41
  * Added the ability to change main login page ID (Only needed for debugging)
42
  * The login will now revert to default wp-login in the case of plugin failure
21
  * Show gravatar to users who are logged in
22
  * Assign custom links to users who are logged in based on their role
23
  * Customize user emails for registration and/or password recovery
24
+ * Send user emails in HTML format
25
  * Allow users to set their own password upon registration
26
 
27
 
38
 
39
  == Changelog ==
40
 
41
+ = 4.2 =
42
+ * Added the option to send e-mails in HTML format
43
+ * Fixed a bug that broke custom user role links if all links were deleted
44
+
45
  = 4.1.2 =
46
  * Added the ability to change main login page ID (Only needed for debugging)
47
  * The login will now revert to default wp-login in the case of plugin failure
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.1.2
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
@@ -21,13 +21,12 @@ if ($wp_version < '2.6') {
21
  if (!class_exists('ThemeMyLogin')) {
22
  class ThemeMyLogin extends WPPluginShell {
23
 
24
- var $version = '4.1.2';
25
  var $options = array();
26
  var $permalink = '';
27
  var $instances = 0;
28
 
29
  function ThemeMyLogin() {
30
- global $wp_version;
31
 
32
  $this->SetPluginTitle('Theme My Login');
33
 
@@ -62,16 +61,14 @@ if (!class_exists('ThemeMyLogin')) {
62
 
63
  $this->LoadOptions();
64
 
65
- if ( !isset($this->options['page_id']) || empty($this->options['page_id']) ) {
66
  $login_page = get_page_by_title('Login');
67
  $this->options['general']['page_id'] = ( $login_page ) ? $login_page->ID : 0;
68
  $this->SaveOptions();
69
  }
70
 
71
- //if ( empty($this->options['general']['page_id']) )
72
- //return;
73
-
74
  $this->SetMailFrom($this->options['general']['from_email'], $this->options['general']['from_name']);
 
75
 
76
  $this->WPPluginShell();
77
 
@@ -130,6 +127,7 @@ if (!class_exists('ThemeMyLogin')) {
130
  $this->options['general']['custom_pass'] = 0;
131
  $this->options['general']['from_name'] = '';
132
  $this->options['general']['from_email'] = '';
 
133
 
134
  $this->options['titles']['welcome'] = __('Welcome') . ', %display_name%';
135
  $this->options['titles']['login'] = __('Log In');
@@ -196,9 +194,9 @@ if (!class_exists('ThemeMyLogin')) {
196
  }
197
 
198
  if ( file_exists(WP_PLUGIN_DIR . '/theme-my-login/theme-my-login.css') )
199
- $this->AddStyle('theme-my-login', WP_PLUGIN_URL . '/theme-my-login/theme-my-login.css');
200
  else
201
- $this->AddStyle('theme-my-login', WP_PLUGIN_URL . '/theme-my-login/css/theme-my-login.css');
202
 
203
  }
204
 
@@ -221,26 +219,26 @@ if (!class_exists('ThemeMyLogin')) {
221
  $wp_scripts->remove('jquery');
222
  $wp_scripts->remove('jquery-ui-core');
223
  $wp_scripts->remove('jquery-ui-tabs');
224
- $this->AddAdminScript('jquery', WP_PLUGIN_URL . '/theme-my-login/js/jquery/jquery.js', false, '1.7.2');
225
- $this->AddAdminScript('jquery-ui-core', WP_PLUGIN_URL . '/theme-my-login/js/jquery/ui.core.js', array('jquery'), '1.7.2');
226
- $this->AddAdminScript('jquery-ui-tabs', WP_PLUGIN_URL . '/theme-my-login/js/jquery/ui.tabs.js', array('jquery', 'jquery-ui-core'), '1.7.2');
227
  }
228
 
229
- $this->AddAdminScript('theme-my-login-admin', WP_PLUGIN_URL . '/theme-my-login/js/theme-my-login-admin.js.php');
230
 
231
- $this->AddAdminStyle('theme-my-login-admin', WP_PLUGIN_URL . '/theme-my-login/css/theme-my-login-admin.css.php');
232
 
233
  if ( version_compare($wp_version, '2.8', '>=') ) {
234
  $admin_color = get_usermeta($user_ID, 'admin_color');
235
  if ( 'classic' == $admin_color ) {
236
- $this->AddAdminStyle('jquery-colors-classic', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-classic/wp-colors-classic.css');
237
  } else {
238
- $this->AddAdminStyle('jquery-colors-fresh', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css');
239
  }
240
  } elseif ( version_compare($wp_version, '2.7', '>=') ) {
241
- $this->AddAdminStyle('jquery-colors-fresh', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css');
242
  } elseif ( version_compare($wp_version, '2.5', '>=') ) {
243
- $this->AddAdminStyle('jquery-colors-classic', WP_PLUGIN_URL . '/theme-my-login/css/wp-colors-classic/wp-colors-classic.css');
244
  }
245
 
246
  if ( 'page.php' == $pagenow && (isset($_REQUEST['post']) && $this->options['general']['page_id'] == $_REQUEST['post']) )
@@ -295,7 +293,7 @@ if (!class_exists('ThemeMyLogin')) {
295
  }
296
 
297
  function WPHead() {
298
- if ( !is_admin() && $this->instances > 0 )
299
  do_action('login_head');
300
  }
301
 
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.2
7
  Author: Jeff Farthing
8
  Author URI: http://www.jfarthing.com
9
  Text Domain: theme-my-login
21
  if (!class_exists('ThemeMyLogin')) {
22
  class ThemeMyLogin extends WPPluginShell {
23
 
24
+ var $version = '4.2';
25
  var $options = array();
26
  var $permalink = '';
27
  var $instances = 0;
28
 
29
  function ThemeMyLogin() {
 
30
 
31
  $this->SetPluginTitle('Theme My Login');
32
 
61
 
62
  $this->LoadOptions();
63
 
64
+ if ( !isset($this->options['general']['page_id']) || empty($this->options['general']['page_id']) ) {
65
  $login_page = get_page_by_title('Login');
66
  $this->options['general']['page_id'] = ( $login_page ) ? $login_page->ID : 0;
67
  $this->SaveOptions();
68
  }
69
 
 
 
 
70
  $this->SetMailFrom($this->options['general']['from_email'], $this->options['general']['from_name']);
71
+ $this->SetMailContentType($this->options['general']['email_format']);
72
 
73
  $this->WPPluginShell();
74
 
127
  $this->options['general']['custom_pass'] = 0;
128
  $this->options['general']['from_name'] = '';
129
  $this->options['general']['from_email'] = '';
130
+ $this->options['general']['email_format'] = 'text/plain';
131
 
132
  $this->options['titles']['welcome'] = __('Welcome') . ', %display_name%';
133
  $this->options['titles']['login'] = __('Log In');
194
  }
195
 
196
  if ( file_exists(WP_PLUGIN_DIR . '/theme-my-login/theme-my-login.css') )
197
+ $this->AddStyle('theme-my-login', plugins_url('/theme-my-login/theme-my-login.css'));
198
  else
199
+ $this->AddStyle('theme-my-login', plugins_url('/theme-my-login/css/theme-my-login.css'));
200
 
201
  }
202
 
219
  $wp_scripts->remove('jquery');
220
  $wp_scripts->remove('jquery-ui-core');
221
  $wp_scripts->remove('jquery-ui-tabs');
222
+ $this->AddAdminScript('jquery', plugins_url('/theme-my-login/js/jquery/jquery.js'), false, '1.7.2');
223
+ $this->AddAdminScript('jquery-ui-core', plugins_url('/theme-my-login/js/jquery/ui.core.js'), array('jquery'), '1.7.2');
224
+ $this->AddAdminScript('jquery-ui-tabs', plugins_url('/theme-my-login/js/jquery/ui.tabs.js'), array('jquery', 'jquery-ui-core'), '1.7.2');
225
  }
226
 
227
+ $this->AddAdminScript('theme-my-login-admin', plugins_url('/theme-my-login/js/theme-my-login-admin.js'));
228
 
229
+ $this->AddAdminStyle('theme-my-login-admin', plugins_url('/theme-my-login/css/theme-my-login-admin.css.php'));
230
 
231
  if ( version_compare($wp_version, '2.8', '>=') ) {
232
  $admin_color = get_usermeta($user_ID, 'admin_color');
233
  if ( 'classic' == $admin_color ) {
234
+ $this->AddAdminStyle('jquery-colors-classic', plugins_url('/theme-my-login/css/wp-colors-classic/wp-colors-classic.css'));
235
  } else {
236
+ $this->AddAdminStyle('jquery-colors-fresh', plugins_url('/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css'));
237
  }
238
  } elseif ( version_compare($wp_version, '2.7', '>=') ) {
239
+ $this->AddAdminStyle('jquery-colors-fresh', plugins_url('/theme-my-login/css/wp-colors-fresh/wp-colors-fresh.css'));
240
  } elseif ( version_compare($wp_version, '2.5', '>=') ) {
241
+ $this->AddAdminStyle('jquery-colors-classic', plugins_url('/theme-my-login/css/wp-colors-classic/wp-colors-classic.css'));
242
  }
243
 
244
  if ( 'page.php' == $pagenow && (isset($_REQUEST['post']) && $this->options['general']['page_id'] == $_REQUEST['post']) )
293
  }
294
 
295
  function WPHead() {
296
+ if ( !is_admin() )
297
  do_action('login_head');
298
  }
299