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

Version Description

  • 11/10/2018 =
  • Fix - Escape attributes on conditional rules
Download this release

Release Info

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

Code changes from version 1.4.8 to 1.4.9

includes/class-ur-ajax.php CHANGED
@@ -155,8 +155,8 @@ class UR_AJAX {
155
  if ( ! isset( $_POST['data'] ) || ( isset( $_POST['data'] ) && gettype( $_POST['data'] ) != 'array' ) ) {
156
  throw new Exception( __( 'post data not set', 'user-registration' ) );
157
 
158
- } elseif ( ! isset( $_POST['data']['form_data'] )
159
- || ( isset( $_POST['data']['form_data'] )
160
  && gettype( $_POST['data']['form_data'] ) != 'string' ) ) {
161
 
162
  throw new Exception( __( 'post data not set', 'user-registration' ) );
@@ -223,7 +223,6 @@ class UR_AJAX {
223
  ) );
224
 
225
  }// End try().
226
-
227
  }
228
 
229
  /**
155
  if ( ! isset( $_POST['data'] ) || ( isset( $_POST['data'] ) && gettype( $_POST['data'] ) != 'array' ) ) {
156
  throw new Exception( __( 'post data not set', 'user-registration' ) );
157
 
158
+ } elseif ( ! isset( $_POST['data']['form_data'] )
159
+ || ( isset( $_POST['data']['form_data'] )
160
  && gettype( $_POST['data']['form_data'] ) != 'string' ) ) {
161
 
162
  throw new Exception( __( 'post data not set', 'user-registration' ) );
223
  ) );
224
 
225
  }// End try().
 
226
  }
227
 
228
  /**
includes/class-ur-email-confirmation.php CHANGED
@@ -45,7 +45,7 @@ class UR_Email_Confirmation {
45
  * @return array
46
  */
47
  public function create_quick_links( $actions, $user ) {
48
-
49
  $verify_link = add_query_arg( array( 'action' => 'verify', 'user' => $user->ID ) );
50
  $verify_link = remove_query_arg( array( 'new_role' ), $verify_link );
51
  $verify_link = wp_nonce_url( $verify_link, 'ur_user_change_email_status' );
@@ -56,15 +56,15 @@ class UR_Email_Confirmation {
56
 
57
  $verify_action = '<a style="color:#086512" href="' . esc_url( $verify_link ) . '">' . _x( 'Verify', 'The action on users list page', 'user-registration' ) . '</a>';
58
  $unverify_action = '<a style="color:#e20707" href="' . esc_url( $unverify_link ) . '">' . _x( 'Unverify', 'The action on users list page', 'user-registration' ) . '</a>';
59
-
60
  if ( current_user_can( 'edit_user' ) ) {
61
  $get_user_status = get_user_meta( $user->ID, 'ur_confirm_email', true );
62
-
63
  if( '0' === $get_user_status ) {
64
  $actions['ur_user_verify_action'] = $verify_action;
65
  } elseif( '1' === $get_user_status ) {
66
  $actions['ur_user_unverify_action'] = $unverify_action;
67
- }
68
  }
69
  return $actions;
70
  }
@@ -91,7 +91,7 @@ class UR_Email_Confirmation {
91
  $user_id = absint( $_GET['user'] );
92
 
93
  if ( $status == 'verify' ) {
94
- update_user_meta( $user_id, 'ur_confirm_email', '1' );
95
  $redirect = add_query_arg( array( 'verified' => 1 ), $redirect );
96
  } else {
97
  update_user_meta( $user_id, 'ur_confirm_email', '0' );
@@ -103,7 +103,6 @@ class UR_Email_Confirmation {
103
  }
104
  }
105
 
106
-
107
  /**
108
  * Add the column header for the email status column
109
  *
@@ -154,28 +153,32 @@ class UR_Email_Confirmation {
154
 
155
  return $val;
156
  }
157
-
158
  /**
159
  * Enqueque CSS to load notice
160
  * @return void
161
  */
162
  public function ur_enqueue_script() {
163
- wp_register_style( 'user-registration-css', UR()->plugin_url().'/assets/css/user-registration.css', array(), UR_VERSION );
164
  wp_enqueue_style('user-registration-css');
165
  }
166
 
 
167
  public function custom_registration_message() {
168
  return ur_print_notice( __('User successfully registered. Login to continue.','user-registration'));
169
  }
170
 
 
171
  public function custom_registration_error_message() {
172
  return ur_print_notice( __('Token Mismatch!','user-registration'), 'error' );
173
  }
174
 
 
175
  public function custom_resend_email_token_message() {
176
  return ur_print_notice( __('Verification Email Sent!','user-registration'));
177
  }
178
 
 
179
  public function custom_resend_email_token_error_message() {
180
  return ur_print_notice( __('User doesnot exist!','user-registration'), 'error' );
181
  }
@@ -187,11 +190,12 @@ class UR_Email_Confirmation {
187
  public function check_token_before_authenticate() {
188
 
189
  $user_reg_successful = false;
190
-
191
  add_action( 'login_enqueue_scripts', array( $this, 'ur_enqueue_script' ), 1 );
192
-
 
193
  if( isset( $_GET['ur_resend_id'] ) && $_GET['ur_resend_token'] == 'true') {
194
-
195
  $user_id = $this->crypt_the_string( $_GET['ur_resend_id'], 'd' );
196
  $user = get_user_by( 'id', $user_id );
197
 
@@ -202,7 +206,7 @@ class UR_Email_Confirmation {
202
  $attachments = apply_filters( 'user_registration_email_attachment_resending_token', array() );
203
 
204
  UR_Emailer::send_mail_to_user( $user->user_email, $user->user_login, $user_id, '', array(), $attachments );
205
-
206
  add_filter('login_message', array( $this,'custom_resend_email_token_message' ) );
207
  add_filter('user_registration_login_form_before_notice', array( $this,'custom_resend_email_token_message' ) );
208
  } else {
@@ -210,9 +214,9 @@ class UR_Email_Confirmation {
210
  add_filter('login_message', array( $this,'custom_resend_email_token_error_message' ) );
211
  add_filter('user_registration_login_form_before_notice', array( $this,'custom_resend_email_token_error_message' ) );
212
  ;
213
- }
214
 
215
- }
216
 
217
  if( ! isset( $_GET['ur_token'] ) ) {
218
  return;
@@ -221,10 +225,11 @@ class UR_Email_Confirmation {
221
  $output = str_split( $_GET['ur_token'], 50 );
222
  $user_id = $this->crypt_the_string( $output[1], 'd');
223
  $user_token = get_user_meta( $user_id, 'ur_confirm_email_token', true );
224
-
225
- if( $user_token == $_GET['ur_token'] ) {
 
226
  $user_reg_successful = true;
227
-
228
  update_user_meta( $user_id, 'ur_confirm_email', 1 );
229
  delete_user_meta( $user_id, 'ur_confirm_email_token');
230
 
@@ -240,34 +245,47 @@ class UR_Email_Confirmation {
240
 
241
  }
242
 
 
 
 
 
 
 
 
 
243
  public function crypt_the_string( $string, $action = 'e' ) {
244
-
245
  $secret_key = 'ur_secret_key';
246
  $secret_iv = 'ur_secret_iv';
247
-
248
  $output = false;
249
  $encrypt_method = "AES-256-CBC";
250
  $key = hash( 'sha256', $secret_key );
251
  $iv = substr( hash( 'sha256', $secret_iv ), 0, 16 );
252
-
253
  if( $action == 'e' ) {
254
  $output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
255
  }
256
  else if( $action == 'd' ){
257
  $output = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv );
258
  }
259
-
260
  return $output;
261
  }
262
 
263
- public function get_token($user_id) {
 
 
 
 
 
264
 
265
  $length = 50;
266
  $token = "";
267
  $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
268
  $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz";
269
  $codeAlphabet.= "0123456789";
270
- $max = strlen($codeAlphabet);
271
 
272
  for ($i=0; $i < $length; $i++) {
273
  $token .= $codeAlphabet[random_int(0, $max-1)];
@@ -280,15 +298,26 @@ class UR_Email_Confirmation {
280
  do_action('user_registration_get_token');
281
  }
282
 
 
 
 
 
 
 
283
  public function set_email_status( $valid_form_data, $form_id, $user_id ) {
284
 
285
  if( 'email_confirmation' === get_option( 'user_registration_general_setting_login_options' ) ) {
286
  $token = $this->get_token($user_id);
287
  update_user_meta( $user_id, 'ur_confirm_email', 0 );
288
- update_user_meta( $user_id, 'ur_confirm_email_token', $token );
289
  }
290
  }
291
 
 
 
 
 
 
292
  public function check_email_status( WP_User $user ) {
293
 
294
  $email_status = get_user_meta($user->ID, 'ur_confirm_email', true);
@@ -313,7 +342,7 @@ class UR_Email_Confirmation {
313
  * @return \WP_Error
314
  */
315
  public function allow_password_reset( $result, $user_id ) {
316
-
317
  $email_status = get_user_meta($user_id, 'ur_confirm_email', true);
318
 
319
  if ( $email_status === '0' ) {
@@ -324,16 +353,19 @@ class UR_Email_Confirmation {
324
  return $result;
325
  }
326
 
327
- /* @deprecated 1.4.0
328
- * @param string $string the string to encrypt/decrypt, $action the action encrypt or decrypt
 
 
329
  * @return void
330
  */
331
  public function my_simple_crypt( $string, $action ) {
332
  ur_deprecated_function( 'UR_Email_Confirmation::my_simple_crypt', '1.4.0', 'UR_Email_Confirmation::crypt_the_string' );
333
  }
334
 
335
- /* @deprecated 1.4.0
336
- * @param $user_id
 
337
  * @return void
338
  */
339
  public function getToken( $user_id ) {
@@ -341,4 +373,4 @@ class UR_Email_Confirmation {
341
  }
342
  }
343
 
344
- new UR_Email_Confirmation();
45
  * @return array
46
  */
47
  public function create_quick_links( $actions, $user ) {
48
+
49
  $verify_link = add_query_arg( array( 'action' => 'verify', 'user' => $user->ID ) );
50
  $verify_link = remove_query_arg( array( 'new_role' ), $verify_link );
51
  $verify_link = wp_nonce_url( $verify_link, 'ur_user_change_email_status' );
56
 
57
  $verify_action = '<a style="color:#086512" href="' . esc_url( $verify_link ) . '">' . _x( 'Verify', 'The action on users list page', 'user-registration' ) . '</a>';
58
  $unverify_action = '<a style="color:#e20707" href="' . esc_url( $unverify_link ) . '">' . _x( 'Unverify', 'The action on users list page', 'user-registration' ) . '</a>';
59
+
60
  if ( current_user_can( 'edit_user' ) ) {
61
  $get_user_status = get_user_meta( $user->ID, 'ur_confirm_email', true );
62
+
63
  if( '0' === $get_user_status ) {
64
  $actions['ur_user_verify_action'] = $verify_action;
65
  } elseif( '1' === $get_user_status ) {
66
  $actions['ur_user_unverify_action'] = $unverify_action;
67
+ }
68
  }
69
  return $actions;
70
  }
91
  $user_id = absint( $_GET['user'] );
92
 
93
  if ( $status == 'verify' ) {
94
+ update_user_meta( $user_id, 'ur_confirm_email', '1' );
95
  $redirect = add_query_arg( array( 'verified' => 1 ), $redirect );
96
  } else {
97
  update_user_meta( $user_id, 'ur_confirm_email', '0' );
103
  }
104
  }
105
 
 
106
  /**
107
  * Add the column header for the email status column
108
  *
153
 
154
  return $val;
155
  }
156
+
157
  /**
158
  * Enqueque CSS to load notice
159
  * @return void
160
  */
161
  public function ur_enqueue_script() {
162
+ wp_register_style( 'user-registration-css', UR()->plugin_url().'/assets/css/user-registration.css', array(), UR_VERSION );
163
  wp_enqueue_style('user-registration-css');
164
  }
165
 
166
+ // Successful registration message.
167
  public function custom_registration_message() {
168
  return ur_print_notice( __('User successfully registered. Login to continue.','user-registration'));
169
  }
170
 
171
+ // Token mismatch message.
172
  public function custom_registration_error_message() {
173
  return ur_print_notice( __('Token Mismatch!','user-registration'), 'error' );
174
  }
175
 
176
+ // Resend verification email message.
177
  public function custom_resend_email_token_message() {
178
  return ur_print_notice( __('Verification Email Sent!','user-registration'));
179
  }
180
 
181
+ // Resend verification email error message.
182
  public function custom_resend_email_token_error_message() {
183
  return ur_print_notice( __('User doesnot exist!','user-registration'), 'error' );
184
  }
190
  public function check_token_before_authenticate() {
191
 
192
  $user_reg_successful = false;
193
+
194
  add_action( 'login_enqueue_scripts', array( $this, 'ur_enqueue_script' ), 1 );
195
+
196
+ // Condition for resending token.
197
  if( isset( $_GET['ur_resend_id'] ) && $_GET['ur_resend_token'] == 'true') {
198
+
199
  $user_id = $this->crypt_the_string( $_GET['ur_resend_id'], 'd' );
200
  $user = get_user_by( 'id', $user_id );
201
 
206
  $attachments = apply_filters( 'user_registration_email_attachment_resending_token', array() );
207
 
208
  UR_Emailer::send_mail_to_user( $user->user_email, $user->user_login, $user_id, '', array(), $attachments );
209
+
210
  add_filter('login_message', array( $this,'custom_resend_email_token_message' ) );
211
  add_filter('user_registration_login_form_before_notice', array( $this,'custom_resend_email_token_message' ) );
212
  } else {
214
  add_filter('login_message', array( $this,'custom_resend_email_token_error_message' ) );
215
  add_filter('user_registration_login_form_before_notice', array( $this,'custom_resend_email_token_error_message' ) );
216
  ;
217
+ }
218
 
219
+ }
220
 
221
  if( ! isset( $_GET['ur_token'] ) ) {
222
  return;
225
  $output = str_split( $_GET['ur_token'], 50 );
226
  $user_id = $this->crypt_the_string( $output[1], 'd');
227
  $user_token = get_user_meta( $user_id, 'ur_confirm_email_token', true );
228
+
229
+ // Check if the token matches the token value stored in db.
230
+ if( $user_token == $_GET['ur_token'] ) {
231
  $user_reg_successful = true;
232
+
233
  update_user_meta( $user_id, 'ur_confirm_email', 1 );
234
  delete_user_meta( $user_id, 'ur_confirm_email_token');
235
 
245
 
246
  }
247
 
248
+ /**
249
+ * Encrypt/Decrypt the provided string.
250
+ * Encrypt while setting token and updating to database, decrypt while comparing the stored token.
251
+ *
252
+ * @param string $string String to encrypt/decrypt
253
+ * @param string $action Encrypt/decrypt action. 'e' for encrypt and 'd' for decrypt
254
+ * @return string Encrypted/Decrypted string.
255
+ */
256
  public function crypt_the_string( $string, $action = 'e' ) {
257
+
258
  $secret_key = 'ur_secret_key';
259
  $secret_iv = 'ur_secret_iv';
260
+
261
  $output = false;
262
  $encrypt_method = "AES-256-CBC";
263
  $key = hash( 'sha256', $secret_key );
264
  $iv = substr( hash( 'sha256', $secret_iv ), 0, 16 );
265
+
266
  if( $action == 'e' ) {
267
  $output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
268
  }
269
  else if( $action == 'd' ){
270
  $output = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv );
271
  }
272
+
273
  return $output;
274
  }
275
 
276
+ /**
277
+ * Generate email token for the user.
278
+ * @param int $user_id User ID.
279
+ * @return string Token.
280
+ */
281
+ public function get_token( $user_id ) {
282
 
283
  $length = 50;
284
  $token = "";
285
  $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
286
  $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz";
287
  $codeAlphabet.= "0123456789";
288
+ $max = strlen($codeAlphabet);
289
 
290
  for ($i=0; $i < $length; $i++) {
291
  $token .= $codeAlphabet[random_int(0, $max-1)];
298
  do_action('user_registration_get_token');
299
  }
300
 
301
+ /**
302
+ * Set the token of the user and update it to usermeta table in database.
303
+ * @param array $valid_form_data Form filled data.
304
+ * @param int $form_id Form ID.
305
+ * @param int $user_id User ID.
306
+ */
307
  public function set_email_status( $valid_form_data, $form_id, $user_id ) {
308
 
309
  if( 'email_confirmation' === get_option( 'user_registration_general_setting_login_options' ) ) {
310
  $token = $this->get_token($user_id);
311
  update_user_meta( $user_id, 'ur_confirm_email', 0 );
312
+ update_user_meta( $user_id, 'ur_confirm_email_token', $token );
313
  }
314
  }
315
 
316
+ /**
317
+ * Check the email status during authentication
318
+ * @param WP_User $user User instance
319
+ * @return mixed
320
+ */
321
  public function check_email_status( WP_User $user ) {
322
 
323
  $email_status = get_user_meta($user->ID, 'ur_confirm_email', true);
342
  * @return \WP_Error
343
  */
344
  public function allow_password_reset( $result, $user_id ) {
345
+
346
  $email_status = get_user_meta($user_id, 'ur_confirm_email', true);
347
 
348
  if ( $email_status === '0' ) {
353
  return $result;
354
  }
355
 
356
+ /**
357
+ * @deprecated 1.4.0
358
+ * @param string $string the string to encrypt/decrypt
359
+ * @param string $action the action encrypt or decrypt
360
  * @return void
361
  */
362
  public function my_simple_crypt( $string, $action ) {
363
  ur_deprecated_function( 'UR_Email_Confirmation::my_simple_crypt', '1.4.0', 'UR_Email_Confirmation::crypt_the_string' );
364
  }
365
 
366
+ /**
367
+ * @deprecated 1.4.0
368
+ * @param $user_id User's ID.
369
  * @return void
370
  */
371
  public function getToken( $user_id ) {
373
  }
374
  }
375
 
376
+ new UR_Email_Confirmation();
includes/functions-ur-template.php CHANGED
@@ -111,7 +111,7 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
111
 
112
  $rules['rules'] = array_values( $rules['rules'] );
113
 
114
- $rules = ( ! empty( $rules['rules'] ) && isset( $args['enable_conditional_logic'] ) ) ? wp_json_encode( $rules ) : "''";
115
  /*Conditonal Logic codes end*/
116
 
117
  $defaults = array(
@@ -187,7 +187,7 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
187
  switch ( $args['type'] ) {
188
 
189
  case 'textarea' :
190
- $field .= '<textarea data-rules=' . $rules . ' data-id=""' . esc_attr( $key ) . '"" name="' . esc_attr( $key ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" ' . ( empty( $args['custom_attributes']['rows'] ) ? ' rows="2"' : '' ) . ( empty( $args['custom_attributes']['cols'] ) ? ' cols="5"' : '' ) . implode( ' ', $custom_attributes ) . '>' . esc_textarea( $value ) . '</textarea>';
191
  break;
192
 
193
  case 'checkbox' :
@@ -218,13 +218,13 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
218
  }
219
 
220
  $field .= '<label>';
221
- $field .= ' <input data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" ' . implode( ' ', $custom_attributes ) . ' data-value="' . $choice_index . '" type="' . esc_attr( $args['type'] ) . '" class="input-checkbox ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '[]" id="' . esc_attr( $args['id'] ) . '_' . esc_attr( $choice_index ) . '" value="'.trim($choice).'"' . $value . ' /> ';
222
  $field .= trim( $choice ) . ' </label>';
223
  $checkbox_start++;
224
  }
225
  } else {
226
  $field = '<label class="checkbox ' . implode( ' ', $custom_attributes ) . '">
227
- <input data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" ' . implode( ' ', $custom_attributes ) . ' data-value="' . $value . '" type="' . esc_attr( $args['type'] ) . '" class="input-checkbox ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="1" ' . checked( $value, 1, false ) . ' /> '
228
  . $args['label'] . $required . '</label>';
229
  if ( $args['description'] ) {
230
  $field .= '<span class="description">' . $args['description'] . '</span>';
@@ -245,10 +245,10 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
245
  $extra_params = json_decode( get_user_meta( get_current_user_id(), $extra_params_key, true ) );
246
 
247
  if ( empty( $extra_params ) ) {
248
- $field .= '<input data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" type="' . esc_attr( $args['type'] ) . '" class="input-text input-' . esc_attr( $args['type'] ) ." " .esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
249
  }
250
  else {
251
- $field .= '<input data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" type="' . esc_attr( $args['type'] ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
252
  }
253
  break;
254
 
@@ -267,7 +267,7 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
267
  $options .= '<option value="' . esc_attr( trim( $option_key ) ) . '" ' . selected( $value, trim( $option_key ), false ) . '>' . esc_attr( trim( $option_text ) ) . '</option>';
268
  }
269
 
270
- $field .= '<select data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="select ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" ' . implode( ' ', $custom_attributes ) . ' data-placeholder="' . esc_attr( $args['placeholder'] ) . '">
271
  ' . $options . '
272
  </select>';
273
  }
@@ -301,7 +301,7 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
301
  }
302
  }
303
 
304
- $field .= '<select multiple data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '[]" id="' . esc_attr( $args['id'] ) . '" class="select ur-enhanced-select' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" ' . implode( ' ', $custom_attributes ) . ' data-placeholder="' . esc_attr( $args['placeholder'] ) . '">
305
  ' . $options . '
306
  </select>';
307
  }
@@ -314,7 +314,7 @@ if ( ! function_exists( 'user_registration_form_field' ) ) {
314
 
315
  $field .= '<label for="' . esc_attr( $args['id'] ) . '_' . esc_attr( $option_key ) . '" class="radio">';
316
 
317
- $field .= '<input data-rules=' . $rules . ' data-id="' . esc_attr( $key ) . '" type="radio" class="input-radio ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" default_value="' . esc_attr( trim ( $option_key ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '_' . esc_attr( $option_key ) . '" ' . implode( ' ', $custom_attributes ) . ' / ' . checked( $value, trim( $option_key ), false ) . ' />' . wp_kses( trim( $option_text ), array(
318
  'a' => array(
319
  'href' => array(),
320
  'title' => array()
111
 
112
  $rules['rules'] = array_values( $rules['rules'] );
113
 
114
+ $rules = ( ! empty( $rules['rules'] ) && isset( $args['enable_conditional_logic'] ) ) ? wp_json_encode( $rules ) : "";
115
  /*Conditonal Logic codes end*/
116
 
117
  $defaults = array(
187
  switch ( $args['type'] ) {
188
 
189
  case 'textarea' :
190
+ $field .= '<textarea data-rules="' . esc_attr( $rules ) . '" data-id=""' . esc_attr( $key ) . '"" name="' . esc_attr( $key ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" ' . ( empty( $args['custom_attributes']['rows'] ) ? ' rows="2"' : '' ) . ( empty( $args['custom_attributes']['cols'] ) ? ' cols="5"' : '' ) . implode( ' ', $custom_attributes ) . '>' . esc_textarea( $value ) . '</textarea>';
191
  break;
192
 
193
  case 'checkbox' :
218
  }
219
 
220
  $field .= '<label>';
221
+ $field .= ' <input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" ' . implode( ' ', $custom_attributes ) . ' data-value="' . $choice_index . '" type="' . esc_attr( $args['type'] ) . '" class="input-checkbox ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '[]" id="' . esc_attr( $args['id'] ) . '_' . esc_attr( $choice_index ) . '" value="'.trim($choice).'"' . $value . ' /> ';
222
  $field .= trim( $choice ) . ' </label>';
223
  $checkbox_start++;
224
  }
225
  } else {
226
  $field = '<label class="checkbox ' . implode( ' ', $custom_attributes ) . '">
227
+ <input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" ' . implode( ' ', $custom_attributes ) . ' data-value="' . $value . '" type="' . esc_attr( $args['type'] ) . '" class="input-checkbox ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="1" ' . checked( $value, 1, false ) . ' /> '
228
  . $args['label'] . $required . '</label>';
229
  if ( $args['description'] ) {
230
  $field .= '<span class="description">' . $args['description'] . '</span>';
245
  $extra_params = json_decode( get_user_meta( get_current_user_id(), $extra_params_key, true ) );
246
 
247
  if ( empty( $extra_params ) ) {
248
+ $field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="' . esc_attr( $args['type'] ) . '" class="input-text input-' . esc_attr( $args['type'] ) ." " .esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
249
  }
250
  else {
251
+ $field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="' . esc_attr( $args['type'] ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
252
  }
253
  break;
254
 
267
  $options .= '<option value="' . esc_attr( trim( $option_key ) ) . '" ' . selected( $value, trim( $option_key ), false ) . '>' . esc_attr( trim( $option_text ) ) . '</option>';
268
  }
269
 
270
+ $field .= '<select data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="select ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" ' . implode( ' ', $custom_attributes ) . ' data-placeholder="' . esc_attr( $args['placeholder'] ) . '">
271
  ' . $options . '
272
  </select>';
273
  }
301
  }
302
  }
303
 
304
+ $field .= '<select multiple data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '[]" id="' . esc_attr( $args['id'] ) . '" class="select ur-enhanced-select' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" ' . implode( ' ', $custom_attributes ) . ' data-placeholder="' . esc_attr( $args['placeholder'] ) . '">
305
  ' . $options . '
306
  </select>';
307
  }
314
 
315
  $field .= '<label for="' . esc_attr( $args['id'] ) . '_' . esc_attr( $option_key ) . '" class="radio">';
316
 
317
+ $field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="radio" class="input-radio ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" default_value="' . esc_attr( trim ( $option_key ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '_' . esc_attr( $option_key ) . '" ' . implode( ' ', $custom_attributes ) . ' / ' . checked( $value, trim( $option_key ), false ) . ' />' . wp_kses( trim( $option_text ), array(
318
  'a' => array(
319
  'href' => array(),
320
  'title' => array()
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.4.7\n"
6
  "Report-Msgid-Bugs-To: wpeverest@gmail.com\n"
7
- "POT-Creation-Date: 2018-10-08 07:13: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"
@@ -101,7 +101,7 @@ msgstr ""
101
 
102
  #: includes/admin/class-ur-admin-menus.php:307
103
  #: includes/admin/class-ur-admin-user-list-manager.php:174
104
- #: includes/class-ur-email-confirmation.php:119
105
  msgid "Status"
106
  msgstr ""
107
 
@@ -1304,11 +1304,11 @@ msgstr ""
1304
  msgid "Could not save form. Invalid field name. Please check all field name"
1305
  msgstr ""
1306
 
1307
- #: includes/class-ur-email-confirmation.php:147
1308
  msgid "Verified"
1309
  msgstr ""
1310
 
1311
- #: includes/class-ur-email-confirmation.php:149
1312
  msgid "Pending"
1313
  msgstr ""
1314
 
@@ -1316,19 +1316,19 @@ msgstr ""
1316
  msgid "User successfully registered. Login to continue."
1317
  msgstr ""
1318
 
1319
- #: includes/class-ur-email-confirmation.php:172
1320
  msgid "Token Mismatch!"
1321
  msgstr ""
1322
 
1323
- #: includes/class-ur-email-confirmation.php:176
1324
  msgid "Verification Email Sent!"
1325
  msgstr ""
1326
 
1327
- #: includes/class-ur-email-confirmation.php:180
1328
  msgid "User doesnot exist!"
1329
  msgstr ""
1330
 
1331
- #: includes/class-ur-email-confirmation.php:299
1332
  #: includes/class-ur-form-handler.php:268
1333
  #: includes/class-ur-form-handler.php:272
1334
  #: includes/class-ur-form-handler.php:276
@@ -1338,17 +1338,17 @@ msgstr ""
1338
  msgid "ERROR:"
1339
  msgstr ""
1340
 
1341
- #: includes/class-ur-email-confirmation.php:299
1342
  msgid ""
1343
  "Your account is still pending approval. Verifiy your email by clicking on "
1344
  "the link sent to your email. %s"
1345
  msgstr ""
1346
 
1347
- #: includes/class-ur-email-confirmation.php:299
1348
  msgid "Resend Verification Link"
1349
  msgstr ""
1350
 
1351
- #: includes/class-ur-email-confirmation.php:320
1352
  msgid ""
1353
  "Email not verified! Verifiy your email by clicking on the link sent to your "
1354
  "email."
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.4.8\n"
6
  "Report-Msgid-Bugs-To: wpeverest@gmail.com\n"
7
+ "POT-Creation-Date: 2018-10-11 08:38:25+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
101
 
102
  #: includes/admin/class-ur-admin-menus.php:307
103
  #: includes/admin/class-ur-admin-user-list-manager.php:174
104
+ #: includes/class-ur-email-confirmation.php:118
105
  msgid "Status"
106
  msgstr ""
107
 
1304
  msgid "Could not save form. Invalid field name. Please check all field name"
1305
  msgstr ""
1306
 
1307
+ #: includes/class-ur-email-confirmation.php:146
1308
  msgid "Verified"
1309
  msgstr ""
1310
 
1311
+ #: includes/class-ur-email-confirmation.php:148
1312
  msgid "Pending"
1313
  msgstr ""
1314
 
1316
  msgid "User successfully registered. Login to continue."
1317
  msgstr ""
1318
 
1319
+ #: includes/class-ur-email-confirmation.php:173
1320
  msgid "Token Mismatch!"
1321
  msgstr ""
1322
 
1323
+ #: includes/class-ur-email-confirmation.php:178
1324
  msgid "Verification Email Sent!"
1325
  msgstr ""
1326
 
1327
+ #: includes/class-ur-email-confirmation.php:183
1328
  msgid "User doesnot exist!"
1329
  msgstr ""
1330
 
1331
+ #: includes/class-ur-email-confirmation.php:328
1332
  #: includes/class-ur-form-handler.php:268
1333
  #: includes/class-ur-form-handler.php:272
1334
  #: includes/class-ur-form-handler.php:276
1338
  msgid "ERROR:"
1339
  msgstr ""
1340
 
1341
+ #: includes/class-ur-email-confirmation.php:328
1342
  msgid ""
1343
  "Your account is still pending approval. Verifiy your email by clicking on "
1344
  "the link sent to your email. %s"
1345
  msgstr ""
1346
 
1347
+ #: includes/class-ur-email-confirmation.php:328
1348
  msgid "Resend Verification Link"
1349
  msgstr ""
1350
 
1351
+ #: includes/class-ur-email-confirmation.php:349
1352
  msgid ""
1353
  "Email not verified! Verifiy your email by clicking on the link sent to your "
1354
  "email."
package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "user-registration",
3
- "version": "1.4.8",
4
  "lockfileVersion": 1,
5
  "requires": true,
6
  "dependencies": {
1
  {
2
  "name": "user-registration",
3
+ "version": "1.4.9",
4
  "lockfileVersion": 1,
5
  "requires": true,
6
  "dependencies": {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: user registration, registration, user profile, registration form, login fo
4
  Requires at least: 4.0
5
  Requires PHP: 5.4
6
  Tested up to: 4.9
7
- Stable tag: 1.4.8
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -108,6 +108,9 @@ Yes, the plugin is designed to work with any themes that have been coded followi
108
 
109
  == Changelog ==
110
 
 
 
 
111
  = 1.4.8 - 09/10/2018 =
112
  * Fix - Default reCaptcha checked on login settings
113
  * Fix - Deactivation notice on certain conditions
4
  Requires at least: 4.0
5
  Requires PHP: 5.4
6
  Tested up to: 4.9
7
+ Stable tag: 1.4.9
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
108
 
109
  == Changelog ==
110
 
111
+ = 1.4.9 - 11/10/2018 =
112
+ * Fix - Escape attributes on conditional rules
113
+
114
  = 1.4.8 - 09/10/2018 =
115
  * Fix - Default reCaptcha checked on login settings
116
  * Fix - Deactivation notice on certain conditions
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.4.8
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.4.8';
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.4.9
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.4.9';
34
 
35
  /**
36
  * Session instance.