Theme My Login - Version 7.0.4

Version Description

  • Fix a notice that appears when unregistering an action
  • Don't fire form actions until the form is being rendered
  • Set a secure cookie for sites using SSL
  • Add login_init and login_form_{$action} action hooks
  • Add login_head and login_enqueue_scripts action hooks
  • Add register_form, lostpassword_form, and resetpass_form action hooks
  • Add signup_hidden_fields, signup_extra_fields, and signup_blogform action hooks
Download this release

Release Info

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

Code changes from version 7.0.3 to 7.0.4

includes/actions.php CHANGED
@@ -325,6 +325,12 @@ function tml_action_handler() {
325
 
326
  nocache_headers();
327
 
 
 
 
 
 
 
328
  /**
329
  * Fires when a TML action is being requested.
330
  *
@@ -342,14 +348,7 @@ function tml_login_handler() {
342
 
343
  $errors = new WP_Error;
344
 
345
- // Set a cookie now to see if they are supported by the browser.
346
- $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) );
347
- if ( ! isset( $_COOKIE[ TEST_COOKIE ] ) ) {
348
- setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
349
- if ( SITECOOKIEPATH != COOKIEPATH ) {
350
- setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
351
- }
352
- }
353
 
354
  // If the user wants ssl but the session is not ssl, force a secure cookie.
355
  if ( ! empty( $_POST['log'] ) && ! force_ssl_admin() ) {
@@ -362,6 +361,7 @@ function tml_login_handler() {
362
 
363
  if ( $user ) {
364
  if ( get_user_option( 'use_ssl', $user->ID ) ) {
 
365
  force_ssl_admin( true );
366
  }
367
  }
@@ -370,7 +370,7 @@ function tml_login_handler() {
370
  if ( ! empty( $_REQUEST['redirect_to'] ) ) {
371
  $redirect_to = $_REQUEST['redirect_to'];
372
  // Redirect to https if user wants ssl
373
- if ( force_ssl_admin() && false !== strpos( $redirect_to, 'wp-admin' ) ) {
374
  $redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
375
  }
376
  } else {
@@ -381,13 +381,13 @@ function tml_login_handler() {
381
 
382
  if ( isset( $_POST['log'] ) || isset( $_GET['testcookie'] ) ) {
383
 
384
- $user = wp_signon( array(), force_ssl_admin() );
385
 
386
  $redirect_to = apply_filters( 'login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user );
387
 
388
  if ( ! is_wp_error( $user ) && empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
389
  $redirect_to = add_query_arg( array(
390
- 'testcookie' => 1,
391
  'redirect_to' => $redirect_to
392
  ) );
393
  wp_redirect( $redirect_to );
325
 
326
  nocache_headers();
327
 
328
+ /** This action is documented in wp-login.php */
329
+ do_action( 'login_init' );
330
+
331
+ /** This action is documented in wp-login.php */
332
+ do_action( 'login_form_' . tml_get_action()->get_name() );
333
+
334
  /**
335
  * Fires when a TML action is being requested.
336
  *
348
 
349
  $errors = new WP_Error;
350
 
351
+ $secure_cookie = '';
 
 
 
 
 
 
 
352
 
353
  // If the user wants ssl but the session is not ssl, force a secure cookie.
354
  if ( ! empty( $_POST['log'] ) && ! force_ssl_admin() ) {
361
 
362
  if ( $user ) {
363
  if ( get_user_option( 'use_ssl', $user->ID ) ) {
364
+ $secure_cookie = true;
365
  force_ssl_admin( true );
366
  }
367
  }
370
  if ( ! empty( $_REQUEST['redirect_to'] ) ) {
371
  $redirect_to = $_REQUEST['redirect_to'];
372
  // Redirect to https if user wants ssl
373
+ if ( $secure_cookie && false !== strpos( $redirect_to, 'wp-admin' ) ) {
374
  $redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
375
  }
376
  } else {
381
 
382
  if ( isset( $_POST['log'] ) || isset( $_GET['testcookie'] ) ) {
383
 
384
+ $user = wp_signon( array(), $secure_cookie );
385
 
386
  $redirect_to = apply_filters( 'login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user );
387
 
388
  if ( ! is_wp_error( $user ) && empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
389
  $redirect_to = add_query_arg( array(
390
+ 'testcookie' => 1,
391
  'redirect_to' => $redirect_to
392
  ) );
393
  wp_redirect( $redirect_to );
includes/class-theme-my-login-form-field.php CHANGED
@@ -94,6 +94,8 @@ class Theme_My_Login_Form_Field {
94
  /**
95
  * The arguments used for rendering the field.
96
  *
 
 
97
  * @see Theme_My_Login_Form_Field::render()
98
  *
99
  * @var array
@@ -504,6 +506,10 @@ class Theme_My_Login_Form_Field {
504
  public function render( $args = array() ) {
505
  $is_hidden = ( 'hidden' == $this->get_type() );
506
 
 
 
 
 
507
  $defaults = wp_parse_args( $this->render_args, array(
508
  'before' => $is_hidden ? '' : '<div class="tml-field-wrap tml-%s-wrap">',
509
  'after' => $is_hidden ? '' : '</div>',
94
  /**
95
  * The arguments used for rendering the field.
96
  *
97
+ * Alternatively, if the field type is "action", this is used as the action arguments.
98
+ *
99
  * @see Theme_My_Login_Form_Field::render()
100
  *
101
  * @var array
506
  public function render( $args = array() ) {
507
  $is_hidden = ( 'hidden' == $this->get_type() );
508
 
509
+ if ( 'action' == $this->get_type() ) {
510
+ return tml_buffer_action_hook( $this->get_name(), $this->render_args );
511
+ }
512
+
513
  $defaults = wp_parse_args( $this->render_args, array(
514
  'before' => $is_hidden ? '' : '<div class="tml-field-wrap tml-%s-wrap">',
515
  'after' => $is_hidden ? '' : '</div>',
includes/class-theme-my-login.php CHANGED
@@ -108,7 +108,7 @@ final class Theme_My_Login {
108
 
109
  $action->remove_callback_hook();
110
 
111
- unset( $this->actions[ $action ] );
112
  }
113
  }
114
  }
108
 
109
  $action->remove_callback_hook();
110
 
111
+ unset( $this->actions[ $action->get_name() ] );
112
  }
113
  }
114
  }
includes/forms.php CHANGED
@@ -50,9 +50,8 @@ function tml_register_login_form() {
50
  'priority' => 15
51
  ) );
52
 
53
- tml_add_form_field( 'login', 'login_form_action', array(
54
- 'type' => 'custom',
55
- 'content' => tml_buffer_action_hook( 'login_form' ),
56
  'priority' => 20,
57
  ) );
58
 
@@ -157,24 +156,29 @@ function tml_register_registration_form() {
157
  ) );
158
  }
159
 
 
 
 
 
 
160
  if ( ! tml_allow_user_passwords() ) {
161
  tml_add_form_field( 'register', 'reg_passmail', array(
162
  'type' => 'custom',
163
  'content' => '<p id="reg_passmail">' . __( 'Registration confirmation will be emailed to you.' ) . '</p>',
164
- 'priority' => 25,
165
  ) );
166
  }
167
 
168
  tml_add_form_field( 'register', 'submit', array(
169
  'type' => 'submit',
170
  'value' => __( 'Register' ),
171
- 'priority' => 30,
172
  ) );
173
 
174
  tml_add_form_field( 'register', 'redirect_to', array(
175
  'type' => 'hidden',
176
  'value' => apply_filters( 'registration_redirect', tml_get_request_value( 'redirect_to' ) ),
177
- 'priority' => 30,
178
  ) );
179
  }
180
 
@@ -197,16 +201,21 @@ function tml_register_lost_password_form() {
197
  'priority' => 10,
198
  ) );
199
 
 
 
 
 
 
200
  tml_add_form_field( 'lostpassword', 'submit', array(
201
  'type' => 'submit',
202
  'value' => __( 'Get New Password' ),
203
- 'priority' => 30,
204
  ) );
205
 
206
  tml_add_form_field( 'lostpassword', 'redirect_to', array(
207
  'type' => 'hidden',
208
  'value' => apply_filters( 'lostpassword_redirect', tml_get_request_value( 'redirect_to' ) ),
209
- 'priority' => 30,
210
  ) );
211
  }
212
 
@@ -250,10 +259,16 @@ function tml_register_password_reset_form() {
250
  'priority' => 10,
251
  ) );
252
 
 
 
 
 
 
 
253
  tml_add_form_field( 'resetpass', 'submit', array(
254
  'type' => 'submit',
255
  'value' => __( 'Reset Password' ),
256
- 'priority' => 30,
257
  ) );
258
 
259
  $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
@@ -263,7 +278,7 @@ function tml_register_password_reset_form() {
263
  tml_add_form_field( 'resetpass', 'rp_key', array(
264
  'type' => 'hidden',
265
  'value' => $rp_key,
266
- 'priority' => 30,
267
  ) );
268
  }
269
  }
50
  'priority' => 15
51
  ) );
52
 
53
+ tml_add_form_field( 'login', 'login_form', array(
54
+ 'type' => 'action',
 
55
  'priority' => 20,
56
  ) );
57
 
156
  ) );
157
  }
158
 
159
+ tml_add_form_field( 'register', 'register_form', array(
160
+ 'type' => 'action',
161
+ 'priority' => 25,
162
+ ) );
163
+
164
  if ( ! tml_allow_user_passwords() ) {
165
  tml_add_form_field( 'register', 'reg_passmail', array(
166
  'type' => 'custom',
167
  'content' => '<p id="reg_passmail">' . __( 'Registration confirmation will be emailed to you.' ) . '</p>',
168
+ 'priority' => 30,
169
  ) );
170
  }
171
 
172
  tml_add_form_field( 'register', 'submit', array(
173
  'type' => 'submit',
174
  'value' => __( 'Register' ),
175
+ 'priority' => 35,
176
  ) );
177
 
178
  tml_add_form_field( 'register', 'redirect_to', array(
179
  'type' => 'hidden',
180
  'value' => apply_filters( 'registration_redirect', tml_get_request_value( 'redirect_to' ) ),
181
+ 'priority' => 35,
182
  ) );
183
  }
184
 
201
  'priority' => 10,
202
  ) );
203
 
204
+ tml_add_form_field( 'lostpassword', 'lostpassword_form', array(
205
+ 'type' => 'action',
206
+ 'priority' => 15,
207
+ ) );
208
+
209
  tml_add_form_field( 'lostpassword', 'submit', array(
210
  'type' => 'submit',
211
  'value' => __( 'Get New Password' ),
212
+ 'priority' => 20,
213
  ) );
214
 
215
  tml_add_form_field( 'lostpassword', 'redirect_to', array(
216
  'type' => 'hidden',
217
  'value' => apply_filters( 'lostpassword_redirect', tml_get_request_value( 'redirect_to' ) ),
218
+ 'priority' => 20,
219
  ) );
220
  }
221
 
259
  'priority' => 10,
260
  ) );
261
 
262
+ tml_add_form_field( 'resetpass', 'resetpass_form', array(
263
+ 'type' => 'action',
264
+ 'priority' => 15,
265
+ 'render_args' => array( wp_get_current_user() )
266
+ ) );
267
+
268
  tml_add_form_field( 'resetpass', 'submit', array(
269
  'type' => 'submit',
270
  'value' => __( 'Reset Password' ),
271
+ 'priority' => 20,
272
  ) );
273
 
274
  $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
278
  tml_add_form_field( 'resetpass', 'rp_key', array(
279
  'type' => 'hidden',
280
  'value' => $rp_key,
281
+ 'priority' => 20,
282
  ) );
283
  }
284
  }
includes/functions.php CHANGED
@@ -203,6 +203,14 @@ function tml_enqueue_scripts() {
203
  'action' => tml_is_action() ? tml_get_action()->get_name() : '',
204
  'errors' => tml_get_errors()->get_error_codes(),
205
  ) );
 
 
 
 
 
 
 
 
206
  }
207
 
208
  /**
203
  'action' => tml_is_action() ? tml_get_action()->get_name() : '',
204
  'errors' => tml_get_errors()->get_error_codes(),
205
  ) );
206
+
207
+ if ( tml_is_action() ) {
208
+ /** This action is documented in wp-login.php */
209
+ do_action( 'login_enqueue_scripts' );
210
+
211
+ /** This action is documented in wp-login.php */
212
+ do_action( 'login_head' );
213
+ }
214
  }
215
 
216
  /**
includes/ms-functions.php CHANGED
@@ -16,7 +16,7 @@ function tml_ms_register_default_actions() {
16
  tml_register_action( 'signup', array(
17
  'title' => '',
18
  'slug' => 'signup',
19
- 'handler' => 'tml_ms_signup_handler',
20
  'network' => true,
21
  'show_on_forms' => false,
22
  'show_in_widget' => false,
@@ -26,7 +26,7 @@ function tml_ms_register_default_actions() {
26
  tml_register_action( 'activate', array(
27
  'title' => '',
28
  'slug' => 'activate',
29
- 'handler' => 'tml_ms_activation_handler',
30
  'network' => true,
31
  'show_on_forms' => false,
32
  'show_in_widget' => false,
@@ -70,6 +70,11 @@ function tml_ms_register_user_signup_form() {
70
  'priority' => 5,
71
  ) );
72
 
 
 
 
 
 
73
  if ( tml_is_default_registration_type() ) {
74
  tml_add_form_field( 'user_signup', 'user_name', array(
75
  'type' => 'text',
@@ -106,6 +111,11 @@ function tml_ms_register_user_signup_form() {
106
  'priority' => 15,
107
  ) );
108
 
 
 
 
 
 
109
  $active_signup = tml_ms_signup_get_active_signup();
110
 
111
  if ( 'blog' == $active_signup ) {
@@ -173,6 +183,11 @@ function tml_ms_register_blog_signup_form() {
173
  'priority' => 5,
174
  ) );
175
 
 
 
 
 
 
176
  tml_ms_add_blog_signup_form_fields( 'blog_signup' );
177
 
178
  tml_add_form_field( 'blog_signup', 'submit', array(
@@ -205,6 +220,11 @@ function tml_ms_register_another_blog_signup_form() {
205
  'priority' => 5,
206
  ) );
207
 
 
 
 
 
 
208
  tml_ms_add_blog_signup_form_fields( 'another_blog_signup' );
209
 
210
  tml_add_form_field( 'another_blog_signup', 'submit', array(
@@ -295,6 +315,11 @@ function tml_ms_add_blog_signup_form_fields( $form ) {
295
  'control_before' => __( 'Allow search engines to index this site.' ) . '<br style="clear:both" />',
296
  ),
297
  ) );
 
 
 
 
 
298
  }
299
 
300
  /**
16
  tml_register_action( 'signup', array(
17
  'title' => '',
18
  'slug' => 'signup',
19
+ 'callback' => 'tml_ms_signup_handler',
20
  'network' => true,
21
  'show_on_forms' => false,
22
  'show_in_widget' => false,
26
  tml_register_action( 'activate', array(
27
  'title' => '',
28
  'slug' => 'activate',
29
+ 'callback' => 'tml_ms_activation_handler',
30
  'network' => true,
31
  'show_on_forms' => false,
32
  'show_in_widget' => false,
70
  'priority' => 5,
71
  ) );
72
 
73
+ tml_add_form_field( 'user_signup', 'signup_hidden_fields', array(
74
+ 'type' => 'action',
75
+ 'render_args' => array( 'validate-user' ),
76
+ ) );
77
+
78
  if ( tml_is_default_registration_type() ) {
79
  tml_add_form_field( 'user_signup', 'user_name', array(
80
  'type' => 'text',
111
  'priority' => 15,
112
  ) );
113
 
114
+ tml_add_form_field( 'user_signup', 'signup_extra_fields', array(
115
+ 'type' => 'action',
116
+ 'render_args' => array( tml_get_errors() ),
117
+ ) );
118
+
119
  $active_signup = tml_ms_signup_get_active_signup();
120
 
121
  if ( 'blog' == $active_signup ) {
183
  'priority' => 5,
184
  ) );
185
 
186
+ tml_add_form_field( 'blog_signup', 'signup_hidden_fields', array(
187
+ 'type' => 'action',
188
+ 'render_args' => array( 'validate-site' ),
189
+ ) );
190
+
191
  tml_ms_add_blog_signup_form_fields( 'blog_signup' );
192
 
193
  tml_add_form_field( 'blog_signup', 'submit', array(
220
  'priority' => 5,
221
  ) );
222
 
223
+ tml_add_form_field( 'another_blog_signup', 'signup_hidden_fields', array(
224
+ 'type' => 'action',
225
+ 'render_args' => array( 'create-another-site' ),
226
+ ) );
227
+
228
  tml_ms_add_blog_signup_form_fields( 'another_blog_signup' );
229
 
230
  tml_add_form_field( 'another_blog_signup', 'submit', array(
315
  'control_before' => __( 'Allow search engines to index this site.' ) . '<br style="clear:both" />',
316
  ),
317
  ) );
318
+
319
+ tml_add_form_field( $form, 'signup_blogform', array(
320
+ 'type' => 'action',
321
+ 'render_args' => array( tml_get_errors() ),
322
+ ) );
323
  }
324
 
325
  /**
languages/theme-my-login.pot CHANGED
@@ -2,33 +2,33 @@
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.3\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-15T20:03:50-04:00\n"
13
- "PO-Revision-Date: 2018-06-15T20:03:50-04:00\n"
14
  "X-Domain: theme-my-login\n"
15
 
16
- #: includes/functions.php:394
17
  #: admin/functions.php:223
18
  msgid "Theme My Login Actions"
19
  msgstr ""
20
 
21
- #: includes/functions.php:395
22
  msgid "Theme My Login Action"
23
  msgstr ""
24
 
25
- #: includes/functions.php:423
26
- #: includes/functions.php:450
27
- #: includes/functions.php:465
28
  msgid "TML Action"
29
  msgstr ""
30
 
31
- #: includes/functions.php:549
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 ""
34
 
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.4\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-18T19:50:47-04:00\n"
13
+ "PO-Revision-Date: 2018-06-18T19:50:47-04:00\n"
14
  "X-Domain: theme-my-login\n"
15
 
16
+ #: includes/functions.php:402
17
  #: admin/functions.php:223
18
  msgid "Theme My Login Actions"
19
  msgstr ""
20
 
21
+ #: includes/functions.php:403
22
  msgid "Theme My Login Action"
23
  msgstr ""
24
 
25
+ #: includes/functions.php:431
26
+ #: includes/functions.php:458
27
+ #: includes/functions.php:473
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 ""
34
 
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.3
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.3 =
63
  * Fix an error on PHP versions less than 5.3
64
  * Allow for description in settings API functions
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.4
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.4 =
63
+ * Fix a notice that appears when unregistering an action
64
+ * Don't fire form actions until the form is being rendered
65
+ * Set a secure cookie for sites using SSL
66
+ * Add `login_init` and `login_form_{$action}` action hooks
67
+ * Add `login_head` and `login_enqueue_scripts` action hooks
68
+ * Add `register_form`, `lostpassword_form`, and `resetpass_form` action hooks
69
+ * Add `signup_hidden_fields`, `signup_extra_fields`, and `signup_blogform` action hooks
70
+
71
  = 7.0.3 =
72
  * Fix an error on PHP versions less than 5.3
73
  * Allow for description in settings API functions
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.3
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.3' );
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.4
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.4' );
28
 
29
  /**
30
  * Stores the path to TML.