Theme My Login - Version 7.0.7

Version Description

  • Fix sorting of form fields
  • Fix "Remember Me" not being clickable
  • Add "checked" property to form fields to allow for easy checking of checkboxes
  • Add plugin textdomain to strings not found in front-end core transalations
  • Add tml_send_new_user_notification filter
  • Add tml_send_new_user_admin_notification filter
  • Add tml_retrieve_password_email filter
Download this release

Release Info

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

Code changes from version 7.0.6 to 7.0.7

includes/class-theme-my-login-form-field.php CHANGED
@@ -152,9 +152,9 @@ class Theme_My_Login_Form_Field {
152
  if ( ! empty( $args['class'] ) ) {
153
  $this->add_attribute( 'class', $args['class'] );
154
  } elseif ( 'hidden' != $this->get_type() ) {
155
- if ( in_array( $this->get_type(), array( 'button', 'submit', 'reset' ) ) ) {
156
  $class = 'tml-button';
157
- } elseif ( in_array( $this->get_type(), array( 'checkbox', 'radio', 'radio-group' ) ) ) {
158
  $class = 'tml-checkbox';
159
  } else {
160
  $class = 'tml-field';
@@ -162,6 +162,10 @@ class Theme_My_Login_Form_Field {
162
  $this->add_attribute( 'class', $class );
163
  }
164
 
 
 
 
 
165
  foreach ( (array) $args['attributes'] as $key => $value ) {
166
  $this->add_attribute( $key, $value );
167
  }
152
  if ( ! empty( $args['class'] ) ) {
153
  $this->add_attribute( 'class', $args['class'] );
154
  } elseif ( 'hidden' != $this->get_type() ) {
155
+ if ( in_array( $args['type'], array( 'button', 'submit', 'reset' ) ) ) {
156
  $class = 'tml-button';
157
+ } elseif ( in_array( $args['type'], array( 'checkbox', 'radio', 'radio-group' ) ) ) {
158
  $class = 'tml-checkbox';
159
  } else {
160
  $class = 'tml-field';
162
  $this->add_attribute( 'class', $class );
163
  }
164
 
165
+ if ( 'checkbox' == $args['type'] && ! empty( $args['checked'] ) ) {
166
+ $this->add_attribute( 'checked', 'checked' );
167
+ }
168
+
169
  foreach ( (array) $args['attributes'] as $key => $value ) {
170
  $this->add_attribute( $key, $value );
171
  }
includes/class-theme-my-login-form.php CHANGED
@@ -312,12 +312,15 @@ class Theme_My_Login_Form {
312
  $priorities[ $priority ][] = $field;
313
  }
314
 
 
 
315
  // Sort the fields
316
  foreach ( $priorities as $priority => $fields ) {
317
  foreach ( $fields as $field ) {
318
  $sorted_fields[] = $field;
319
  }
320
  }
 
321
 
322
  return $sorted_fields;
323
  }
312
  $priorities[ $priority ][] = $field;
313
  }
314
 
315
+ ksort( $priorities );
316
+
317
  // Sort the fields
318
  foreach ( $priorities as $priority => $fields ) {
319
  foreach ( $fields as $field ) {
320
  $sorted_fields[] = $field;
321
  }
322
  }
323
+ unset( $priorities );
324
 
325
  return $sorted_fields;
326
  }
includes/compat.php CHANGED
@@ -120,7 +120,37 @@ function tml_retrieve_password_notification( $user, $key ) {
120
  */
121
  $message = apply_filters( 'retrieve_password_message', $message, $key, $user->user_login, $user );
122
 
123
- if ( $message && ! wp_mail( $user->user_email, wp_specialchars_decode( $title ), $message ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  wp_die( __( 'The email could not be sent.' ) . "<br />\n" . __( 'Possible reason: your host may have disabled the mail() function.' ) );
125
  }
126
  }
120
  */
121
  $message = apply_filters( 'retrieve_password_message', $message, $key, $user->user_login, $user );
122
 
123
+ $retrieve_password_email = array(
124
+ 'to' => $user->user_email,
125
+ 'subject' => $title,
126
+ 'message' => $message,
127
+ 'headers' => '',
128
+ );
129
+
130
+ /**
131
+ * Filters the contents of the password retrieval email.
132
+ *
133
+ * @since 7.0.6
134
+ *
135
+ * @param array $retrieve_password_email {
136
+ * Used to build wp_mail().
137
+ *
138
+ * @type string $to The recipient of the email.
139
+ * @type string $subject The subject of the email.
140
+ * @type string $message The body of the email.
141
+ * @type string $headers The headers of the email.
142
+ * }
143
+ * @param WP_User $user The user object..
144
+ * @param string $blogname The site title.
145
+ */
146
+ $retrieve_password_email = apply_filters( 'tml_retrieve_password_email', $retrieve_password_email, $user, $blogname );
147
+
148
+ if ( $retrieve_password_email['message'] && ! wp_mail(
149
+ $retrieve_password_email['to'],
150
+ wp_specialchars_decode( sprintf( $retrieve_password_email['subject'], $blogname ) ),
151
+ $retrieve_password_email['message'],
152
+ $retrieve_password_email['headers']
153
+ ) ) {
154
  wp_die( __( 'The email could not be sent.' ) . "<br />\n" . __( 'Possible reason: your host may have disabled the mail() function.' ) );
155
  }
156
  }
includes/forms.php CHANGED
@@ -59,6 +59,7 @@ function tml_register_login_form() {
59
  'type' => 'checkbox',
60
  'label' => __( 'Remember Me' ),
61
  'value' => 'forever',
 
62
  'priority' => 25,
63
  ) );
64
 
@@ -135,7 +136,7 @@ function tml_register_registration_form() {
135
 
136
  tml_add_form_field( 'register', 'user_pass2', array(
137
  'type' => 'password',
138
- 'label' => __( 'Confirm Password' ),
139
  'id' => 'pass2',
140
  'attributes' => array(
141
  'autocomplete' => 'off',
59
  'type' => 'checkbox',
60
  'label' => __( 'Remember Me' ),
61
  'value' => 'forever',
62
+ 'id' => 'rememberme',
63
  'priority' => 25,
64
  ) );
65
 
136
 
137
  tml_add_form_field( 'register', 'user_pass2', array(
138
  'type' => 'password',
139
+ 'label' => __( 'Confirm Password', 'theme-my-login' ),
140
  'id' => 'pass2',
141
  'attributes' => array(
142
  'autocomplete' => 'off',
includes/functions.php CHANGED
@@ -532,13 +532,13 @@ function tml_validate_new_user_password( $errors = null ) {
532
  }
533
  if ( tml_allow_user_passwords() ) {
534
  if ( empty( $_POST['user_pass1'] ) || empty( $_POST['user_pass2'] ) ) {
535
- $errors->add( 'empty_password', __( '<strong>ERROR</strong>: Please enter a password.' ) );
536
 
537
  } elseif ( false !== strpos( stripslashes( $_POST['user_pass1'] ), "\\" ) ) {
538
- $errors->add( 'password_backslash', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ) );
539
 
540
  } elseif ( $_POST['user_pass1'] !== $_POST['user_pass2'] ) {
541
- $errors->add( 'password_mismatch', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ) );
542
  }
543
  }
544
  return $errors;
@@ -698,6 +698,61 @@ function tml_handle_auto_login( $user_id ) {
698
  wp_set_auth_cookie( $user_id );
699
  }
700
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701
  /**
702
  * Add an error.
703
  *
532
  }
533
  if ( tml_allow_user_passwords() ) {
534
  if ( empty( $_POST['user_pass1'] ) || empty( $_POST['user_pass2'] ) ) {
535
+ $errors->add( 'empty_password', __( '<strong>ERROR</strong>: Please enter a password.', 'theme-my-login' ) );
536
 
537
  } elseif ( false !== strpos( stripslashes( $_POST['user_pass1'] ), "\\" ) ) {
538
+ $errors->add( 'password_backslash', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".', 'theme-my-login' ) );
539
 
540
  } elseif ( $_POST['user_pass1'] !== $_POST['user_pass2'] ) {
541
+ $errors->add( 'password_mismatch', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.', 'theme-my-login' ) );
542
  }
543
  }
544
  return $errors;
698
  wp_set_auth_cookie( $user_id );
699
  }
700
 
701
+ /**
702
+ * Send the new user notifications.
703
+ *
704
+ * @since 7.0.7
705
+ */
706
+ function tml_send_new_user_notifications( $user_id, $notify = 'both' ) {
707
+
708
+ /**
709
+ * Filters whether to send the new user notification or not.
710
+ *
711
+ * @since 7.0.7
712
+ *
713
+ * @param bool $send_user_notification Whether to send the new user notification or not.
714
+ */
715
+ $send_user_notification = (bool) apply_filters( 'tml_send_new_user_notification', true );
716
+
717
+ /**
718
+ * Filters whether to send the new user admin notification or not.
719
+ *
720
+ * @since 7.0.7
721
+ *
722
+ * @param bool $send_admin_notification Whether to send the new user admin notification or not.
723
+ */
724
+ $send_admin_notification = (bool) apply_filters( 'tml_send_new_user_admin_notification', true );
725
+
726
+ // Bail if both are disabled
727
+ if ( ! ( $send_user_notification || $send_admin_notification ) ) {
728
+ return;
729
+ }
730
+
731
+ // Set to both if empty
732
+ if ( empty( $notify ) ) {
733
+ $notify = 'admin';
734
+
735
+ // Set to admin if set to both and user is disabled
736
+ } elseif ( 'both' == $notify ) {
737
+ if ( ! $send_user_notification ) {
738
+ $notify = 'admin';
739
+ } elseif ( ! $send_admin_notification ) {
740
+ $notify = 'user';
741
+ }
742
+ }
743
+
744
+ // Bail if type is admin and it is disabled
745
+ if ( 'admin' == $notify && ! $send_admin_notification ) {
746
+ return;
747
+
748
+ // Bail if type is user and it is disabled
749
+ } elseif ( 'user' == $notify && ! $send_user_notification ) {
750
+ return;
751
+ }
752
+
753
+ wp_new_user_notification( $user_id, null, $notify );
754
+ }
755
+
756
  /**
757
  * Add an error.
758
  *
includes/hooks.php CHANGED
@@ -35,7 +35,13 @@ add_action( 'wp_enqueue_scripts', 'tml_enqueue_scripts', 10 );
35
 
36
  // Registration
37
  add_action( 'register_new_user', 'tml_set_new_user_password' );
38
- add_action( 'register_new_user', 'tml_handle_auto_login' );
 
 
 
 
 
 
39
 
40
  // Passwords
41
  add_action( 'retrieved_password_key', 'tml_retrieve_password_notification', 10, 2 );
35
 
36
  // Registration
37
  add_action( 'register_new_user', 'tml_set_new_user_password' );
38
+ add_action( 'register_new_user', 'tml_handle_auto_login' );
39
+
40
+ add_action( 'register_new_user', 'tml_send_new_user_notifications' );
41
+ add_action( 'edit_user_created_user', 'tml_send_new_user_notifications' );
42
+
43
+ remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
44
+ remove_action( 'edit_user_created_user', 'wp_send_new_user_notifications' );
45
 
46
  // Passwords
47
  add_action( 'retrieved_password_key', 'tml_retrieve_password_notification', 10, 2 );
languages/theme-my-login.pot CHANGED
@@ -2,15 +2,15 @@
2
  # This file is distributed under the same license as the Theme My Login package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Theme My Login 7.0.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/theme-my-login\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2018-06-22T15:04:10-04:00\n"
13
- "PO-Revision-Date: 2018-06-22T15:04:10-04:00\n"
14
  "X-Domain: theme-my-login\n"
15
 
16
  #: includes/functions.php:402
@@ -28,6 +28,18 @@ msgstr ""
28
  msgid "TML Action"
29
  msgstr ""
30
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  #: includes/functions.php:557
32
  msgid "If you have already set your own password, you may disregard this email and use the password you have already set."
33
  msgstr ""
@@ -55,6 +67,10 @@ msgstr ""
55
  msgid "Show action links?"
56
  msgstr ""
57
 
 
 
 
 
58
  #: includes/extensions.php:189
59
  #: includes/extensions.php:220
60
  #: includes/extensions.php:250
2
  # This file is distributed under the same license as the Theme My Login package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Theme My Login 7.0.7\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/theme-my-login\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2018-06-24T17:54:40-04:00\n"
13
+ "PO-Revision-Date: 2018-06-24T17:54:40-04:00\n"
14
  "X-Domain: theme-my-login\n"
15
 
16
  #: includes/functions.php:402
28
  msgid "TML Action"
29
  msgstr ""
30
 
31
+ #: includes/functions.php:535
32
+ msgid "<strong>ERROR</strong>: Please enter a password."
33
+ msgstr ""
34
+
35
+ #: includes/functions.php:538
36
+ msgid "<strong>ERROR</strong>: Passwords may not contain the character \"\\\"."
37
+ msgstr ""
38
+
39
+ #: includes/functions.php:541
40
+ msgid "<strong>ERROR</strong>: Please enter the same password in both password fields."
41
+ msgstr ""
42
+
43
  #: includes/functions.php:557
44
  msgid "If you have already set your own password, you may disregard this email and use the password you have already set."
45
  msgstr ""
67
  msgid "Show action links?"
68
  msgstr ""
69
 
70
+ #: includes/forms.php:139
71
+ msgid "Confirm Password"
72
+ msgstr ""
73
+
74
  #: includes/extensions.php:189
75
  #: includes/extensions.php:220
76
  #: includes/extensions.php:250
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: thememylogin, jfarthing84
3
  Tags: login, register, password, branding, customize, widget, wp-login, wp-login.php
4
  Requires at least: 4.6
5
  Tested up to: 4.9.6
6
- Stable tag: 7.0.6
7
 
8
  The ultimate login branding solution! Theme My Login offers matchless customization of your WordPress user experience!
9
 
@@ -59,6 +59,15 @@ Report bugs, suggest ideas and participate in development at [GitHub](https://gi
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
 
62
  = 7.0.6 =
63
  * Fix a fatal error when removing form fields
64
  * Fix a 408/502 error when hosted with Namecheap
3
  Tags: login, register, password, branding, customize, widget, wp-login, wp-login.php
4
  Requires at least: 4.6
5
  Tested up to: 4.9.6
6
+ Stable tag: 7.0.7
7
 
8
  The ultimate login branding solution! Theme My Login offers matchless customization of your WordPress user experience!
9
 
59
 
60
  == Changelog ==
61
 
62
+ = 7.0.7 =
63
+ * Fix sorting of form fields
64
+ * Fix "Remember Me" not being clickable
65
+ * Add "checked" property to form fields to allow for easy checking of checkboxes
66
+ * Add plugin textdomain to strings not found in front-end core transalations
67
+ * Add `tml_send_new_user_notification` filter
68
+ * Add `tml_send_new_user_admin_notification` filter
69
+ * Add `tml_retrieve_password_email` filter
70
+
71
  = 7.0.6 =
72
  * Fix a fatal error when removing form fields
73
  * Fix a 408/502 error when hosted with Namecheap
theme-my-login.php CHANGED
@@ -10,7 +10,7 @@
10
  Plugin Name: Theme My Login
11
  Plugin URI: https://thememylogin.com
12
  Description: Creates an alternate login, registration and password recovery experience within your theme.
13
- Version: 7.0.6
14
  Author: Theme My Login
15
  Author URI: https://thememylogin.com
16
  License: GPLv2
@@ -24,7 +24,7 @@ Network: true
24
  *
25
  * @since 7.0
26
  */
27
- define( 'THEME_MY_LOGIN_VERSION', '7.0.6' );
28
 
29
  /**
30
  * Stores the path to TML.
10
  Plugin Name: Theme My Login
11
  Plugin URI: https://thememylogin.com
12
  Description: Creates an alternate login, registration and password recovery experience within your theme.
13
+ Version: 7.0.7
14
  Author: Theme My Login
15
  Author URI: https://thememylogin.com
16
  License: GPLv2
24
  *
25
  * @since 7.0
26
  */
27
+ define( 'THEME_MY_LOGIN_VERSION', '7.0.7' );
28
 
29
  /**
30
  * Stores the path to TML.