User Registration – Custom Registration Form, Login Form And User Profile For WordPress - Version 1.5.3

Version Description

  • 10/12/2018 =
  • Tweak - Conditionally load flatpickr if only form has date field.
  • Fix - Enqueque CSS on block editor
Download this release

Release Info

Developer wpeverest
Plugin Icon 128x128 User Registration – Custom Registration Form, Login Form And User Profile For WordPress
Version 1.5.3
Comparing to
See all releases

Code changes from version 1.5.2 to 1.5.3

includes/class-ur-form-block.php CHANGED
@@ -17,23 +17,20 @@ class UR_Form_Block {
17
 
18
  add_action( 'init', array( $this, 'register_block' ) );
19
  add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
20
- add_action( 'enqueue_block_assets', array( $this, 'enqueue_block_assets' ) );
21
  }
22
 
23
- public function enqueue_block_assets() {
 
 
 
 
 
24
  wp_register_style(
25
  'user-registration-block-editor',
26
  UR()->plugin_url() . '/assets/css/user-registration.css',
27
  array( 'wp-edit-blocks' ),
28
  UR_VERSION
29
  );
30
- }
31
-
32
- /**
33
- * Enqueue Block Editor Assets.
34
- * @return void.
35
- */
36
- public function enqueue_block_editor_assets() {
37
 
38
  wp_register_script(
39
  'user-registration-block-editor',
17
 
18
  add_action( 'init', array( $this, 'register_block' ) );
19
  add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
 
20
  }
21
 
22
+ /**
23
+ * Enqueue Block Editor Assets.
24
+ * @return void.
25
+ */
26
+ public function enqueue_block_editor_assets() {
27
+
28
  wp_register_style(
29
  'user-registration-block-editor',
30
  UR()->plugin_url() . '/assets/css/user-registration.css',
31
  array( 'wp-edit-blocks' ),
32
  UR_VERSION
33
  );
 
 
 
 
 
 
 
34
 
35
  wp_register_script(
36
  'user-registration-block-editor',
includes/class-ur-frontend-scripts.php CHANGED
@@ -191,7 +191,7 @@ class UR_Frontend_Scripts {
191
  ),
192
  'user-registration' => array(
193
  'src' => self::get_asset_url( 'assets/js/frontend/user-registration' . $suffix . '.js' ),
194
- 'deps' => array( 'jquery' , 'flatpickr','ur-jquery-validate', 'ur-inputmask' ),
195
  'version' => UR_VERSION,
196
  ),
197
  'ur-lost-password' => array(
191
  ),
192
  'user-registration' => array(
193
  'src' => self::get_asset_url( 'assets/js/frontend/user-registration' . $suffix . '.js' ),
194
+ 'deps' => array( 'jquery','ur-jquery-validate', 'ur-inputmask' ),
195
  'version' => UR_VERSION,
196
  ),
197
  'ur-lost-password' => array(
includes/class-ur-shortcodes.php CHANGED
@@ -160,9 +160,15 @@ class UR_Shortcodes {
160
  $minimum_password_strength = ur_get_single_post_meta( $form_id, 'user_registration_form_setting_minimum_password_strength' );
161
 
162
  // Enqueue script.
163
- wp_enqueue_style( 'flatpickr' );
164
  wp_enqueue_script( 'user-registration' );
165
 
 
 
 
 
 
 
 
166
  if ( 'yes' === $enable_strong_password ) {
167
  wp_enqueue_script( 'ur-password-strength-meter' );
168
  wp_localize_script( 'ur-password-strength-meter', 'enable_strong_password', $enable_strong_password );
160
  $minimum_password_strength = ur_get_single_post_meta( $form_id, 'user_registration_form_setting_minimum_password_strength' );
161
 
162
  // Enqueue script.
 
163
  wp_enqueue_script( 'user-registration' );
164
 
165
+ $has_date = ur_has_date_field( $form_id );
166
+
167
+ if( true === $has_date ) {
168
+ wp_enqueue_style( 'flatpickr' );
169
+ wp_enqueue_script( 'flatpickr' );
170
+ }
171
+
172
  if ( 'yes' === $enable_strong_password ) {
173
  wp_enqueue_script( 'ur-password-strength-meter' );
174
  wp_localize_script( 'ur-password-strength-meter', 'enable_strong_password', $enable_strong_password );
includes/functions-ur-core.php CHANGED
@@ -1106,6 +1106,7 @@ function ur_get_recaptcha_node( $recaptcha_enabled = 'no', $context ) {
1106
 
1107
  if( $context === 'login' ) {
1108
  $recaptcha_node = '<div id="node_recaptcha_login" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
 
1109
  } elseif ($context === 'register' ) {
1110
  $recaptcha_node = '<div id="node_recaptcha_register" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
1111
  } else {
@@ -1207,6 +1208,39 @@ function ur_is_json( $str ) {
1207
  return $json && $str != $json;
1208
  }
1209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
  /**
1211
  * @since 1.1.2
1212
  * Output any queued javascript code in the footer.
1106
 
1107
  if( $context === 'login' ) {
1108
  $recaptcha_node = '<div id="node_recaptcha_login" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
1109
+
1110
  } elseif ($context === 'register' ) {
1111
  $recaptcha_node = '<div id="node_recaptcha_register" class="g-recaptcha" style="margin-left:11px;transform:scale(0.77);-webkit-transform:scale(0.77);transform-origin:0 0;-webkit-transform-origin:0 0;"></div>';
1112
  } else {
1208
  return $json && $str != $json;
1209
  }
1210
 
1211
+ /**
1212
+ * Checks if the form contains a date field or not.
1213
+ * @param int $form_id Form ID
1214
+ * @since 1.5.3
1215
+ * @return boolean
1216
+ */
1217
+ function ur_has_date_field( $form_id ) {
1218
+
1219
+ $post = get_post( $form_id );
1220
+
1221
+ if( $post ) {
1222
+
1223
+ if( $post->post_type !== 'user_registration' ) {
1224
+ return false;
1225
+ }
1226
+
1227
+ $post_content = isset( $post->post_content ) ? $post->post_content : '';
1228
+ $post_content_array = json_decode( $post_content );
1229
+
1230
+ foreach ( $post_content_array as $post_content_row ) {
1231
+ foreach ( $post_content_row as $post_content_grid ) {
1232
+ foreach ( $post_content_grid as $field ) {
1233
+ if( isset( $field->field_key ) && $field->field_key === 'date' ) {
1234
+ return true;
1235
+ }
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+
1241
+ return false;
1242
+ }
1243
+
1244
  /**
1245
  * @since 1.1.2
1246
  * Output any queued javascript code in the footer.
includes/functions-ur-template.php CHANGED
@@ -45,7 +45,7 @@ function ur_login_template_redirect() {
45
 
46
  $post_content = isset( $post->post_content ) ? $post->post_content : '';
47
 
48
- if ( has_shortcode( $post_content, 'user_registration_login' ) && is_user_logged_in() ) {
49
  preg_match( '/' . get_shortcode_regex() . '/s', $post_content, $matches );
50
 
51
  $attributes = shortcode_parse_atts( $matches[3] );
45
 
46
  $post_content = isset( $post->post_content ) ? $post->post_content : '';
47
 
48
+ if ( ( has_shortcode( $post_content, 'user_registration_login' ) || has_shortcode( $post_content, 'user_registration_my_account' ) ) && is_user_logged_in() ) {
49
  preg_match( '/' . get_shortcode_regex() . '/s', $post_content, $matches );
50
 
51
  $attributes = shortcode_parse_atts( $matches[3] );
includes/shortcodes/class-ur-shortcode-my-account.php CHANGED
@@ -38,9 +38,6 @@ class UR_Shortcode_My_Account {
38
  public static function output( $atts ) {
39
 
40
  global $wp, $post;
41
-
42
- // Enqueue script.
43
- wp_enqueue_style( 'flatpickr' );
44
  wp_enqueue_script( 'user-registration' );
45
 
46
  if ( ! is_user_logged_in() ) {
@@ -48,7 +45,6 @@ class UR_Shortcode_My_Account {
48
  $recaptcha_enabled = get_option( 'user_registration_login_options_enable_recaptcha', 'no' );
49
  $recaptcha_node = ur_get_recaptcha_node( $recaptcha_enabled, 'login' );
50
  $redirect_url = isset( $atts['redirect_url']) ? trim( $atts['redirect_url'] ) : '';
51
-
52
  $message = apply_filters( 'user_registration_my_account_message', '' );
53
 
54
  if ( ! empty( $message ) ) {
@@ -66,6 +62,21 @@ class UR_Shortcode_My_Account {
66
  ur_get_template( 'myaccount/form-login.php', array( 'recaptcha_node' => $recaptcha_node, 'redirect' => $redirect_url ) );
67
  }
68
  } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  // Start output buffer since the html may need discarding for BW compatibility
70
  ob_start();
71
 
38
  public static function output( $atts ) {
39
 
40
  global $wp, $post;
 
 
 
41
  wp_enqueue_script( 'user-registration' );
42
 
43
  if ( ! is_user_logged_in() ) {
45
  $recaptcha_enabled = get_option( 'user_registration_login_options_enable_recaptcha', 'no' );
46
  $recaptcha_node = ur_get_recaptcha_node( $recaptcha_enabled, 'login' );
47
  $redirect_url = isset( $atts['redirect_url']) ? trim( $atts['redirect_url'] ) : '';
 
48
  $message = apply_filters( 'user_registration_my_account_message', '' );
49
 
50
  if ( ! empty( $message ) ) {
62
  ur_get_template( 'myaccount/form-login.php', array( 'recaptcha_node' => $recaptcha_node, 'redirect' => $redirect_url ) );
63
  }
64
  } else {
65
+
66
+ // Enqueue script.
67
+ $user_id = get_current_user_id();
68
+ $form_id = get_user_meta( $user_id, 'ur_form_id', true );
69
+
70
+ if( ! empty( $form_id ) ) {
71
+
72
+ $has_date = ur_has_date_field( $form_id );
73
+
74
+ if( true === $has_date ) {
75
+ wp_enqueue_style( 'flatpickr' );
76
+ wp_enqueue_script( 'flatpickr' );
77
+ }
78
+ }
79
+
80
  // Start output buffer since the html may need discarding for BW compatibility
81
  ob_start();
82
 
languages/user-registration.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the User Registration package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: User Registration 1.5.1\n"
6
  "Report-Msgid-Bugs-To: wpeverest@gmail.com\n"
7
- "POT-Creation-Date: 2018-11-27 11:11:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -1404,19 +1404,19 @@ msgstr ""
1404
  msgid "Chosen Password"
1405
  msgstr ""
1406
 
1407
- #: includes/class-ur-form-block.php:50
1408
  msgid "Select &#38; display one of your form."
1409
  msgstr ""
1410
 
1411
- #: includes/class-ur-form-block.php:51
1412
  msgid "Select a Form"
1413
  msgstr ""
1414
 
1415
- #: includes/class-ur-form-block.php:52
1416
  msgid "Form Settings"
1417
  msgstr ""
1418
 
1419
- #: includes/class-ur-form-block.php:53
1420
  msgid "Form"
1421
  msgstr ""
1422
 
@@ -3176,28 +3176,28 @@ msgstr ""
3176
  msgid "You are already logged in. <a href=\"%s\">Log out?</a>"
3177
  msgstr ""
3178
 
3179
- #: includes/shortcodes/class-ur-shortcode-my-account.php:60
3180
  msgid "Your password has been reset successfully."
3181
  msgstr ""
3182
 
3183
- #: includes/shortcodes/class-ur-shortcode-my-account.php:73
3184
  msgid "Are you sure you want to log out? <a href=\"%s\">Confirm and log out</a>"
3185
  msgstr ""
3186
 
3187
- #: includes/shortcodes/class-ur-shortcode-my-account.php:203
3188
  msgid "Enter a username or email address."
3189
  msgstr ""
3190
 
3191
- #: includes/shortcodes/class-ur-shortcode-my-account.php:224
3192
- #: includes/shortcodes/class-ur-shortcode-my-account.php:229
3193
  msgid "Invalid username or email."
3194
  msgstr ""
3195
 
3196
- #: includes/shortcodes/class-ur-shortcode-my-account.php:239
3197
  msgid "Password reset is not allowed for this user"
3198
  msgstr ""
3199
 
3200
- #: includes/shortcodes/class-ur-shortcode-my-account.php:252
3201
  msgid "The email could not be sent. Contact your site administrator. "
3202
  msgstr ""
3203
 
2
  # This file is distributed under the same license as the User Registration package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: User Registration 1.5.3\n"
6
  "Report-Msgid-Bugs-To: wpeverest@gmail.com\n"
7
+ "POT-Creation-Date: 2018-12-07 09:29:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
1404
  msgid "Chosen Password"
1405
  msgstr ""
1406
 
1407
+ #: includes/class-ur-form-block.php:47
1408
  msgid "Select &#38; display one of your form."
1409
  msgstr ""
1410
 
1411
+ #: includes/class-ur-form-block.php:48
1412
  msgid "Select a Form"
1413
  msgstr ""
1414
 
1415
+ #: includes/class-ur-form-block.php:49
1416
  msgid "Form Settings"
1417
  msgstr ""
1418
 
1419
+ #: includes/class-ur-form-block.php:50
1420
  msgid "Form"
1421
  msgstr ""
1422
 
3176
  msgid "You are already logged in. <a href=\"%s\">Log out?</a>"
3177
  msgstr ""
3178
 
3179
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:56
3180
  msgid "Your password has been reset successfully."
3181
  msgstr ""
3182
 
3183
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:84
3184
  msgid "Are you sure you want to log out? <a href=\"%s\">Confirm and log out</a>"
3185
  msgstr ""
3186
 
3187
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:214
3188
  msgid "Enter a username or email address."
3189
  msgstr ""
3190
 
3191
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:235
3192
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:240
3193
  msgid "Invalid username or email."
3194
  msgstr ""
3195
 
3196
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:250
3197
  msgid "Password reset is not allowed for this user"
3198
  msgstr ""
3199
 
3200
+ #: includes/shortcodes/class-ur-shortcode-my-account.php:263
3201
  msgid "The email could not be sent. Contact your site administrator. "
3202
  msgstr ""
3203
 
package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "user-registration",
3
- "version": "1.5.2",
4
  "lockfileVersion": 1,
5
  "requires": true,
6
  "dependencies": {
1
  {
2
  "name": "user-registration",
3
+ "version": "1.5.3",
4
  "lockfileVersion": 1,
5
  "requires": true,
6
  "dependencies": {
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
- === User Registration - Custom Registration Form, Login and User Profile for WordPress ===
2
- Contributors: WPEverest
3
  Tags: user registration, registration, user profile, registration form, login form,
4
  Requires at least: 4.0
5
  Requires PHP: 5.4
6
- Tested up to: 4.9
7
- Stable tag: 1.5.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Drag and Drop user registration and login form builder
12
 
13
  == Description ==
14
 
@@ -20,9 +20,9 @@ View [All features](https://wpeverest.com/wordpress-plugins/user-registration/?u
20
 
21
  View [Demo](http://demo.wpeverest.com/user-registration/)
22
 
23
- Get [free support](https://wpeverest.com/support-forum/?utm_source=wporg&utm_medium=link&utm_campaign=user-registration-readme)
24
 
25
- Check [documentation](http://docs.wpeverest.com/docs/user-registration/)
26
 
27
  = User Registration Plugin in action: =
28
 
@@ -109,6 +109,10 @@ Yes, the plugin is designed to work with any themes that have been coded followi
109
 
110
  == Changelog ==
111
 
 
 
 
 
112
  = 1.5.2 - 28/11/2018 =
113
  * Fix - Remove cursor not allowed CSS for flat template
114
 
@@ -184,20 +188,4 @@ Yes, the plugin is designed to work with any themes that have been coded followi
184
  * Change - Date picker to flatpickr
185
  * Add - Email attachement filter
186
 
187
- = 1.4.2 - 11/07/2018 =
188
- * Feature - Gravatar on user profile
189
- * Feature - Layout(vertical/horizontal) on user account
190
- * Feature - Verify/Unverify user by admin in email confirmation
191
- * Refactor - Change account details tab to change password
192
- * Add - Necessary changes required for conditional logic
193
- * Fix - Broken resend verification email link
194
- * Fix - Exclude placeholder for unnecessary fields
195
- * Fix - Single checkbox update issue from admin profile
196
-
197
- = 1.4.1 - 20/06/2018 =
198
- * Fix - Privacy policy field issue
199
- * Fix - Translation ready texts
200
- * Fix - Lost password url
201
- * Add - Scroll bar for overflow form fields
202
-
203
  [See changelog for all versions](https://raw.githubusercontent.com/wpeverest/user-registration/master/CHANGELOG.txt).
1
+ === User Registration - Custom Registration Form, Login And User Profile For WordPress ===
2
+ Contributors: WPEverest, sanzeeb3
3
  Tags: user registration, registration, user profile, registration form, login form,
4
  Requires at least: 4.0
5
  Requires PHP: 5.4
6
+ Tested up to: 5.0
7
+ Stable tag: 1.5.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Drag and drop user registration and login form builder
12
 
13
  == Description ==
14
 
20
 
21
  View [Demo](http://demo.wpeverest.com/user-registration/)
22
 
23
+ Get [Free Support](https://wpeverest.com/support-forum/?utm_source=wporg&utm_medium=link&utm_campaign=user-registration-readme)
24
 
25
+ Check [Documentation](http://docs.wpeverest.com/docs/user-registration/)
26
 
27
  = User Registration Plugin in action: =
28
 
109
 
110
  == Changelog ==
111
 
112
+ = 1.5.3 - 10/12/2018 =
113
+ * Tweak - Conditionally load flatpickr if only form has date field.
114
+ * Fix - Enqueque CSS on block editor
115
+
116
  = 1.5.2 - 28/11/2018 =
117
  * Fix - Remove cursor not allowed CSS for flat template
118
 
188
  * Change - Date picker to flatpickr
189
  * Add - Email attachement filter
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  [See changelog for all versions](https://raw.githubusercontent.com/wpeverest/user-registration/master/CHANGELOG.txt).
user-registration.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: User Registration
4
  * Plugin URI: https://wpeverest.com/plugins/user-registration
5
  * Description: Drag and Drop user registration and login form builder.
6
- * Version: 1.5.2
7
  * Author: WPEverest
8
  * Author URI: https://wpeverest.com
9
  * Text Domain: user-registration
@@ -30,7 +30,7 @@ final class UserRegistration {
30
  * Plugin version.
31
  * @var string
32
  */
33
- public $version = '1.5.2';
34
 
35
  /**
36
  * Session instance.
3
  * Plugin Name: User Registration
4
  * Plugin URI: https://wpeverest.com/plugins/user-registration
5
  * Description: Drag and Drop user registration and login form builder.
6
+ * Version: 1.5.3
7
  * Author: WPEverest
8
  * Author URI: https://wpeverest.com
9
  * Text Domain: user-registration
30
  * Plugin version.
31
  * @var string
32
  */
33
+ public $version = '1.5.3';
34
 
35
  /**
36
  * Session instance.