User registration & user profile – Profile Builder - Version 2.5.1

Version Description

  • Improvements regarding caching plugins and user registration
  • Added a search field in the admin area on the Users with unconfirmed email address screen
  • Improved queries for displaying users in the admin area on the Users with unconfirmed email address screen
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 2.5.1
Comparing to
See all releases

Code changes from version 2.5.0 to 2.5.1

assets/lib/wck-api/wordpress-creation-kit.php CHANGED
@@ -451,7 +451,7 @@ class Wordpress_Creation_Kit_PB{
451
  }
452
  $list .= apply_filters( 'wck_metabox_content_footer_'.$meta , '', $id );
453
  $list .= '</table>';
454
-
455
  $list = apply_filters('wck_metabox_content_'.$meta, $list, $id);
456
  return $list;
457
  }
@@ -463,12 +463,13 @@ class Wordpress_Creation_Kit_PB{
463
 
464
  $wck_element_class = '';
465
  $wck_element_class = apply_filters( "wck_element_class_{$meta}", $wck_element_class, $meta, $results, $element_id );
466
-
467
  $list = '';
468
- $list .= '<tr id="element_'.$element_id.'" ' . $wck_element_class . '>';
469
- $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-number">'. $entry_nr .'</td>';
 
470
  $list .= '<td class="wck-content"><ul>' . "\r\n";
471
-
472
  $j = 0;
473
 
474
  if( !empty( $fields ) ){
@@ -506,7 +507,7 @@ class Wordpress_Creation_Kit_PB{
506
  $details['type'] = 'nested-repeater';
507
 
508
  $list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" data-type="'.$details['type'].'"><strong>'.$details['title'].': </strong>'.$display_value.' </li>' . "\r\n";
509
-
510
  $list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
511
 
512
  $j++;
@@ -533,6 +534,7 @@ class Wordpress_Creation_Kit_PB{
533
  $list .= '</td>';
534
  $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button-secondary" onclick=\'showUpdateFormMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($edit_nonce).'")\' title="'. __( 'Edit this item', 'profile-builder' ) .'">'. apply_filters( 'wck_edit_button', __('Edit','wck'), $meta ) .'</a></td>';
535
  $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-delete"><a href="javascript:void(0)" class="mbdelete" onclick=\'removeMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($delete_nonce).'")\' title="'. __( 'Delete this item', 'profile-builder' ) .'">'. apply_filters( 'wck_delete_button', __( 'Delete', 'wck' ), $meta) .'</a></td>';
 
536
 
537
  $list .= "</tr> \r\n";
538
 
451
  }
452
  $list .= apply_filters( 'wck_metabox_content_footer_'.$meta , '', $id );
453
  $list .= '</table>';
454
+
455
  $list = apply_filters('wck_metabox_content_'.$meta, $list, $id);
456
  return $list;
457
  }
463
 
464
  $wck_element_class = '';
465
  $wck_element_class = apply_filters( "wck_element_class_{$meta}", $wck_element_class, $meta, $results, $element_id );
466
+
467
  $list = '';
468
+ $list .= '<tr id="element_'.$element_id.'" ' . $wck_element_class . '>';
469
+ $list .= apply_filters( 'wck_add_content_before_columns', '', $list );
470
+ $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-number">'. $entry_nr .'</td>';
471
  $list .= '<td class="wck-content"><ul>' . "\r\n";
472
+
473
  $j = 0;
474
 
475
  if( !empty( $fields ) ){
507
  $details['type'] = 'nested-repeater';
508
 
509
  $list .= '<li class="row-'. esc_attr( Wordpress_Creation_Kit_PB::wck_generate_slug( $details['title'], $details ) ) .'" data-type="'.$details['type'].'"><strong>'.$details['title'].': </strong>'.$display_value.' </li>' . "\r\n";
510
+
511
  $list = apply_filters( "wck_after_listed_{$meta}_element_{$j}", $list, $element_id, $value );
512
 
513
  $j++;
534
  $list .= '</td>';
535
  $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-edit"><a href="javascript:void(0)" class="button-secondary" onclick=\'showUpdateFormMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($edit_nonce).'")\' title="'. __( 'Edit this item', 'profile-builder' ) .'">'. apply_filters( 'wck_edit_button', __('Edit','wck'), $meta ) .'</a></td>';
536
  $list .= '<td style="text-align:center;vertical-align:middle;" class="wck-delete"><a href="javascript:void(0)" class="mbdelete" onclick=\'removeMeta("'.esc_js($meta).'", "'.esc_js($id).'", "'.esc_js($element_id).'", "'.esc_js($delete_nonce).'")\' title="'. __( 'Delete this item', 'profile-builder' ) .'">'. apply_filters( 'wck_delete_button', __( 'Delete', 'wck' ), $meta) .'</a></td>';
537
+ $list .= apply_filters( 'wck_add_content_after_columns', '', $list );
538
 
539
  $list .= "</tr> \r\n";
540
 
features/email-confirmation/class-email-confirmation.php CHANGED
@@ -298,27 +298,58 @@ class wpp_list_unfonfirmed_email_table extends PB_WP_List_Table {
298
  global $wpdb;
299
 
300
  $this->dataArray = array();
301
- $iterator = 0;
302
-
303
- $results = $wpdb->get_results("SELECT * FROM ".$wpdb->base_prefix."signups WHERE active = 0");
304
- foreach ($results as $result){
305
- /* since version 2.0.7 for multisite we add a 'registered_for_blog_id' meta in the registration process
306
- so we can display only the users registered on that blog. Also for backwards compatibility we display the users that don't have that meta at all */
307
- if( !empty( $result->meta ) ){
308
- $user_meta = maybe_unserialize( $result->meta );
309
- if( empty( $user_meta['registered_for_blog_id'] ) || $user_meta['registered_for_blog_id'] == get_current_blog_id() ){
310
- $tempArray = array('ID' => $result->user_email, 'username' => $result->user_login, 'email' => $result->user_email, 'registered' => $result->registered);
311
- array_push($this->dataArray, $tempArray);
312
- $iterator++;
313
- }
314
- }
315
- }
316
 
317
  /**
318
  * First, lets decide how many records per page to show
319
  */
320
  $per_page = apply_filters('wppb_email_confirmation_user_per_page_number', 20);
321
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
  /**
324
  * REQUIRED. Now we need to define our column headers. This includes a complete
@@ -358,49 +389,7 @@ class wpp_list_unfonfirmed_email_table extends PB_WP_List_Table {
358
  * be able to use your precisely-queried data immediately.
359
  */
360
  $data = $this->dataArray;
361
-
362
-
363
- /**
364
- * This checks for sorting input and sorts the data in our array accordingly.
365
- *
366
- * In a real-world situation involving a database, you would probably want
367
- * to handle sorting by passing the 'orderby' and 'order' values directly
368
- * to a custom query. The returned data will be pre-sorted, and this array
369
- * sorting technique would be unnecessary.
370
- */
371
- function usort_reorder($a,$b){
372
- $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'username'; //If no sort, default to username
373
- $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
374
- $result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
375
- return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
376
- }
377
- usort($data, 'usort_reorder');
378
 
379
- /**
380
- * REQUIRED for pagination. Let's figure out what page the user is currently
381
- * looking at. We'll need this later, so you should always include it in
382
- * your own package classes.
383
- */
384
- $current_page = $this->get_pagenum();
385
-
386
- /**
387
- * REQUIRED for pagination. Let's check how many items are in our data array.
388
- * In real-world use, this would be the total number of items in your database,
389
- * without filtering. We'll need this later, so you should always include it
390
- * in your own package classes.
391
- */
392
- $total_items = count($data);
393
-
394
-
395
- /**
396
- * The PB_WP_List_Table class does not handle pagination for us, so we need
397
- * to ensure that the data is trimmed to only the current page. We can use
398
- * array_slice() to
399
- */
400
- $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
401
-
402
-
403
-
404
  /**
405
  * REQUIRED. Now we can add our *sorted* data to the items property, where
406
  * it can be used by the rest of the class.
@@ -468,6 +457,7 @@ function wppb_unconfirmed_email_address_custom_menu_page(){
468
  <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
469
  <form id="movies-filter" method="get">
470
  <!-- For plugins, we also need to ensure that the form posts back to our current page -->
 
471
  <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
472
  <!-- Now we can render the completed list table -->
473
  <?php $listTable->display() ?>
298
  global $wpdb;
299
 
300
  $this->dataArray = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
 
302
  /**
303
  * First, lets decide how many records per page to show
304
  */
305
  $per_page = apply_filters('wppb_email_confirmation_user_per_page_number', 20);
306
+ /* determine offset */
307
+ if( !empty( $_REQUEST['paged'] ) ){
308
+ $offset = ( esc_attr( $_REQUEST['paged'] ) -1 ) * $per_page;
309
+ }
310
+ else
311
+ $offset = 0;
312
+
313
+ /* handle order and orderby attr */
314
+ if( !empty( $_REQUEST['orderby'] ) ){
315
+ $orderby = esc_attr( $_REQUEST['orderby'] );
316
+ if( $orderby == 'username' )
317
+ $orderby = 'user_login';
318
+ elseif ( $orderby == 'email' )
319
+ $orderby = 'user_email';
320
+ }
321
+ else
322
+ $orderby = 'user_login';
323
+ if( !empty( $_REQUEST['order'] ) && $_REQUEST['order'] == 'desc' )
324
+ $order = "DESC";
325
+ else
326
+ $order = 'ASC';
327
+
328
+ /* handle the WHERE clause */
329
+ $where = "active = 0";
330
+ if( isset( $_REQUEST['s'] ) && !empty( $_REQUEST['s'] ) ){
331
+ $where .= " AND ( user_login LIKE '%".esc_attr($_REQUEST['s'])."%' OR user_email LIKE '%".esc_attr($_REQUEST['s'])."%' OR registered LIKE '%".esc_attr($_REQUEST['s'])."%' )";
332
+ }
333
+ /* since version 2.0.7 for multisite we add a 'registered_for_blog_id' meta in the registration process
334
+ so we can display only the users registered on that blog. Also for backwards compatibility we display the users that don't have that meta at all */
335
+ if( is_multisite() ){
336
+ $where .= " AND ( meta NOT LIKE '%\"registered_for_blog_id\"%' OR meta LIKE '%\"registered_for_blog_id\";i:".get_current_blog_id()."%' )";
337
+ }
338
+
339
+ $results = $wpdb->get_results("SELECT * FROM ".$wpdb->base_prefix."signups WHERE $where ORDER BY $orderby $order LIMIT $offset, $per_page");
340
+
341
+ foreach ($results as $result){
342
+ $tempArray = array('ID' => $result->user_email, 'username' => $result->user_login, 'email' => $result->user_email, 'registered' => $result->registered);
343
+ array_push($this->dataArray, $tempArray);
344
+ }
345
+
346
+ /**
347
+ * REQUIRED for pagination. Let's check how many items are in our data array.
348
+ * In real-world use, this would be the total number of items in your database,
349
+ * without filtering. We'll need this later, so you should always include it
350
+ * in your own package classes.
351
+ */
352
+ $total_items = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->base_prefix."signups WHERE $where");
353
 
354
  /**
355
  * REQUIRED. Now we need to define our column headers. This includes a complete
389
  * be able to use your precisely-queried data immediately.
390
  */
391
  $data = $this->dataArray;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  /**
394
  * REQUIRED. Now we can add our *sorted* data to the items property, where
395
  * it can be used by the rest of the class.
457
  <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
458
  <form id="movies-filter" method="get">
459
  <!-- For plugins, we also need to ensure that the form posts back to our current page -->
460
+ <?php $listTable->search_box( __( 'Search Users' ), 'user' ); ?>
461
  <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
462
  <!-- Now we can render the completed list table -->
463
  <?php $listTable->display() ?>
features/functions.php CHANGED
@@ -259,7 +259,8 @@ function wppb_print_cpt_script( $hook ){
259
  ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizer' ) ||
260
  ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizerAdmin' ) ||
261
  ( $hook == 'profile-builder_page_profile-builder-add-ons' ) ||
262
- ( $hook == 'profile-builder_page_profile-builder-woocommerce-sync') ||
 
263
  ( $hook == 'admin_page_profile-builder-pms-promo') ) {
264
  wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION );
265
  }
@@ -866,23 +867,25 @@ function wppb_manage_required_attribute() {
866
  if ($wppb_shortcode_on_front) {
867
  ?>
868
  <script type="text/javascript">
869
- jQuery(document).on( "wppbAddRequiredAttributeEvent", "input[type='text'], input[type='email'], input[type='hidden'], textarea, select option, input[type='checkbox'], input[type='radio']", wppbAddRequired );
870
  function wppbAddRequired(event) {
871
- if( jQuery( event.target ).attr( "wppb_cf_temprequired" ) ){
872
- jQuery( event.target ).removeAttr( "wppb_cf_temprequired" );
873
- jQuery( event.target ).attr( "required", "required" );
 
874
  }
875
  }
876
 
877
- jQuery(document).on( "wppbRemoveRequiredAttributeEvent", "input[type='text'], input[type='email'], input[type='hidden'], textarea, select option, input[type='checkbox'], input[type='radio']",wppbRemoveRequired );
878
  function wppbRemoveRequired(event) {
879
- if ( jQuery( event.target ).attr( "required" ) ) {
880
- jQuery(event.target).removeAttr( "required" );
881
- jQuery(event.target).attr( "wppb_cf_temprequired", "wppb_cf_temprequired" );
 
882
  }
883
  }
884
 
885
- jQuery(document).on( "wppbToggleRequiredAttributeEvent", "input[type='text'], input[type='email'], input[type='hidden'], textarea, select option, input[type='checkbox'], input[type='radio']",wppbToggleRequired );
886
  function wppbToggleRequired(event) {
887
  if ( jQuery( event.target ).attr( "required" ) ) {
888
  jQuery( event.target ).removeAttr( "required" );
@@ -892,6 +895,16 @@ function wppb_manage_required_attribute() {
892
  jQuery( event.target ).attr( "required", "required" );
893
  }
894
  }
 
 
 
 
 
 
 
 
 
 
895
  </script>
896
  <?php
897
  }
259
  ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizer' ) ||
260
  ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizerAdmin' ) ||
261
  ( $hook == 'profile-builder_page_profile-builder-add-ons' ) ||
262
+ ( $hook == 'profile-builder_page_profile-builder-woocommerce-sync' ) ||
263
+ ( $hook == 'profile-builder_page_profile-builder-bbpress') ||
264
  ( $hook == 'admin_page_profile-builder-pms-promo') ) {
265
  wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION );
266
  }
867
  if ($wppb_shortcode_on_front) {
868
  ?>
869
  <script type="text/javascript">
870
+ jQuery(document).on( "wppbAddRequiredAttributeEvent", "input[type='text'], input[type='email'], input[type='hidden'], textarea, select, input[type='checkbox'], input[type='radio']", wppbAddRequired );
871
  function wppbAddRequired(event) {
872
+ var element = wppbEventTargetRequiredElement( event.target );
873
+ if( jQuery( element ).attr( "wppb_cf_temprequired" ) ){
874
+ jQuery( element ).removeAttr( "wppb_cf_temprequired" );
875
+ jQuery( element ).attr( "required", "required" );
876
  }
877
  }
878
 
879
+ jQuery(document).on( "wppbRemoveRequiredAttributeEvent", "input[type='text'], input[type='email'], input[type='hidden'], textarea, select, input[type='checkbox'], input[type='radio']",wppbRemoveRequired );
880
  function wppbRemoveRequired(event) {
881
+ var element = wppbEventTargetRequiredElement( event.target );
882
+ if ( jQuery( element ).attr( "required" ) ) {
883
+ jQuery( element ).removeAttr( "required" );
884
+ jQuery( element ).attr( "wppb_cf_temprequired", "wppb_cf_temprequired" );
885
  }
886
  }
887
 
888
+ jQuery(document).on( "wppbToggleRequiredAttributeEvent", "input[type='text'], input[type='email'], input[type='hidden'], textarea, select, input[type='checkbox'], input[type='radio']",wppbToggleRequired );
889
  function wppbToggleRequired(event) {
890
  if ( jQuery( event.target ).attr( "required" ) ) {
891
  jQuery( event.target ).removeAttr( "required" );
895
  jQuery( event.target ).attr( "required", "required" );
896
  }
897
  }
898
+
899
+ function wppbEventTargetRequiredElement( htmlElement ){
900
+ if ( htmlElement.nodeName == "OPTION" ){
901
+ // <option> is the target element, so we need to get the parent <select>, in order to apply the required attribute
902
+ return htmlElement.parentElement;
903
+ }else{
904
+ return htmlElement;
905
+ }
906
+ }
907
+
908
  </script>
909
  <?php
910
  }
front-end/class-formbuilder.php CHANGED
@@ -386,16 +386,19 @@ class Profile_Builder_Form_Creator{
386
  <form enctype="multipart/form-data" method="post" id="<?php if( $this->args['form_type'] == 'register' ) echo 'wppb-register-user'; else if( $this->args['form_type'] == 'edit_profile' ) echo 'wppb-edit-user'; if( isset($this->args['form_name']) && $this->args['form_name'] != "unspecified" ) echo '-' . $this->args['form_name']; ?>" class="wppb-user-forms<?php if( $this->args['form_type'] == 'register' ) echo ' wppb-register-user'; else if( $this->args['form_type'] == 'edit_profile' ) echo ' wppb-edit-user'; echo $wppb_user_role_class; ?>" action="<?php echo apply_filters( 'wppb_form_action', '' ); ?>">
387
  <?php
388
  do_action( 'wppb_form_args_before_output', $this->args );
389
- echo apply_filters( 'wppb_before_form_fields', '<ul>', $this->args['form_type'] );
 
390
  echo $this->wppb_output_form_fields( $_REQUEST, $field_check_errors, $this->args['form_fields'] );
391
- echo apply_filters( 'wppb_after_form_fields', '</ul>', $this->args['form_type'] );
392
-
393
- echo apply_filters( 'wppb_before_send_credentials_checkbox', '<ul>', $this->args['form_type'] );
394
  $this->wppb_add_send_credentials_checkbox( $_REQUEST, $this->args['form_type'] );
395
  echo apply_filters( 'wppb_after_send_credentials_checkbox', '</ul>', $this->args['form_type'] );
 
 
396
  ?>
397
- <p class="form-submit">
398
- <?php
399
  if( $this->args['form_type'] == 'register' )
400
  $button_name = ( current_user_can( 'create_users' ) ? __( 'Add User', 'profile-builder' ) : __( 'Register', 'profile-builder' ) );
401
 
@@ -428,11 +431,11 @@ class Profile_Builder_Form_Creator{
428
 
429
  }
430
 
431
- function wppb_output_form_fields( $global_request, $field_check_errors, $form_fields ){
432
-
433
  $output_fields = '';
434
-
435
  if( !empty( $form_fields ) ){
 
436
  foreach( $form_fields as $field ){
437
  $error_var = ( ( array_key_exists( $field['id'], $field_check_errors ) ) ? ' wppb-field-error' : '' );
438
  $specific_message = ( ( array_key_exists( $field['id'], $field_check_errors ) ) ? $field_check_errors[$field['id']] : '' );
@@ -446,10 +449,12 @@ class Profile_Builder_Form_Creator{
446
  $output_fields .= apply_filters( 'wppb_output_before_form_field', '<li class="'. $css_class .'" id="wppb-form-element-'. $field['id'] .'">', $field, $error_var, $this->args['role'] );
447
  $output_fields .= apply_filters( 'wppb_output_form_field_'.Wordpress_Creation_Kit_PB::wck_generate_slug( $field['field'] ), '', $this->args['form_type'], $field, $this->wppb_get_desired_user_id(), $field_check_errors, $global_request, $this->args['role'], $this );
448
  $output_fields .= apply_filters( 'wppb_output_specific_error_message', $specific_message );
449
- $output_fields .= apply_filters( 'wppb_output_after_form_field', '</li>', $field );
450
  }
 
 
451
  }
452
-
453
  return apply_filters( 'wppb_output_fields_filter', $output_fields );
454
  }
455
 
@@ -488,7 +493,7 @@ class Profile_Builder_Form_Creator{
488
  $output_field_errors[$field['id']] = '<span class="wppb-form-error">' . $error_for_field . '</span>';
489
  }
490
  }
491
-
492
  return apply_filters( 'wppb_output_field_errors_filter', $output_field_errors, $this->args['form_fields'], $global_request, $this->args['form_type'] );
493
  }
494
 
@@ -657,7 +662,7 @@ class Profile_Builder_Form_Creator{
657
  <form method="GET" action="" id="select_user_to_edit_form">
658
  <p class="wppb-form-field">
659
  <label for="edit_user"><?php _e('User to edit:', 'profile-builder') ?></label>
660
- <select id="wppb-edit-user" name="edit_user">
661
  <?php
662
  foreach( $users as $user ){
663
  ?>
@@ -667,7 +672,7 @@ class Profile_Builder_Form_Creator{
667
  ?>
668
  </select>
669
  </p>
670
- <script type="text/javascript">jQuery('#wppb-edit-user').change(function () {
671
  window.location.href = "<?php echo htmlspecialchars_decode( esc_js( esc_url_raw( add_query_arg( array( 'edit_user' => '=' ) ) ) ) ) ?>" + jQuery(this).val();
672
  });</script>
673
  </form>
386
  <form enctype="multipart/form-data" method="post" id="<?php if( $this->args['form_type'] == 'register' ) echo 'wppb-register-user'; else if( $this->args['form_type'] == 'edit_profile' ) echo 'wppb-edit-user'; if( isset($this->args['form_name']) && $this->args['form_name'] != "unspecified" ) echo '-' . $this->args['form_name']; ?>" class="wppb-user-forms<?php if( $this->args['form_type'] == 'register' ) echo ' wppb-register-user'; else if( $this->args['form_type'] == 'edit_profile' ) echo ' wppb-edit-user'; echo $wppb_user_role_class; ?>" action="<?php echo apply_filters( 'wppb_form_action', '' ); ?>">
387
  <?php
388
  do_action( 'wppb_form_args_before_output', $this->args );
389
+
390
+ echo apply_filters( 'wppb_before_form_fields', '<ul>', $this->args['form_type'], $this->args['ID'] );
391
  echo $this->wppb_output_form_fields( $_REQUEST, $field_check_errors, $this->args['form_fields'] );
392
+ echo apply_filters( 'wppb_after_form_fields', '</ul>', $this->args['form_type'], $this->args['ID'] );
393
+
394
+ echo apply_filters( 'wppb_before_send_credentials_checkbox', '<ul>', $this->args['form_type'], $this->args['ID'] );
395
  $this->wppb_add_send_credentials_checkbox( $_REQUEST, $this->args['form_type'] );
396
  echo apply_filters( 'wppb_after_send_credentials_checkbox', '</ul>', $this->args['form_type'] );
397
+
398
+ $wppb_form_submit_extra_attr = apply_filters( 'wppb_form_submit_extra_attr', '', $this->args['form_type'], $this->args['ID'] );
399
  ?>
400
+ <p class="form-submit" <?php echo $wppb_form_submit_extra_attr; ?> >
401
+ <?php
402
  if( $this->args['form_type'] == 'register' )
403
  $button_name = ( current_user_can( 'create_users' ) ? __( 'Add User', 'profile-builder' ) : __( 'Register', 'profile-builder' ) );
404
 
431
 
432
  }
433
 
434
+ function wppb_output_form_fields( $global_request, $field_check_errors, $form_fields, $called_from = NULL ){
 
435
  $output_fields = '';
436
+
437
  if( !empty( $form_fields ) ){
438
+ $output_fields .= apply_filters( 'wppb_output_before_first_form_field', '', $this->args['ID'], $this->args['form_type'], $form_fields, $called_from );
439
  foreach( $form_fields as $field ){
440
  $error_var = ( ( array_key_exists( $field['id'], $field_check_errors ) ) ? ' wppb-field-error' : '' );
441
  $specific_message = ( ( array_key_exists( $field['id'], $field_check_errors ) ) ? $field_check_errors[$field['id']] : '' );
449
  $output_fields .= apply_filters( 'wppb_output_before_form_field', '<li class="'. $css_class .'" id="wppb-form-element-'. $field['id'] .'">', $field, $error_var, $this->args['role'] );
450
  $output_fields .= apply_filters( 'wppb_output_form_field_'.Wordpress_Creation_Kit_PB::wck_generate_slug( $field['field'] ), '', $this->args['form_type'], $field, $this->wppb_get_desired_user_id(), $field_check_errors, $global_request, $this->args['role'], $this );
451
  $output_fields .= apply_filters( 'wppb_output_specific_error_message', $specific_message );
452
+ $output_fields .= apply_filters( 'wppb_output_after_form_field', '</li>', $field, $this->args['ID'], $this->args['form_type'], $called_from );
453
  }
454
+
455
+ $output_fields .= apply_filters( 'wppb_output_after_last_form_field', '', $this->args['ID'], $this->args['form_type'], $called_from );
456
  }
457
+
458
  return apply_filters( 'wppb_output_fields_filter', $output_fields );
459
  }
460
 
493
  $output_field_errors[$field['id']] = '<span class="wppb-form-error">' . $error_for_field . '</span>';
494
  }
495
  }
496
+
497
  return apply_filters( 'wppb_output_field_errors_filter', $output_field_errors, $this->args['form_fields'], $global_request, $this->args['form_type'] );
498
  }
499
 
662
  <form method="GET" action="" id="select_user_to_edit_form">
663
  <p class="wppb-form-field">
664
  <label for="edit_user"><?php _e('User to edit:', 'profile-builder') ?></label>
665
+ <select id="wppb-user-to-edit" name="edit_user">
666
  <?php
667
  foreach( $users as $user ){
668
  ?>
672
  ?>
673
  </select>
674
  </p>
675
+ <script type="text/javascript">jQuery('#wppb-user-to-edit').change(function () {
676
  window.location.href = "<?php echo htmlspecialchars_decode( esc_js( esc_url_raw( add_query_arg( array( 'edit_user' => '=' ) ) ) ) ) ?>" + jQuery(this).val();
677
  });</script>
678
  </form>
front-end/default-fields/default-fields.php CHANGED
@@ -1,35 +1,38 @@
1
  <?php
2
  // include individual modules
3
- $wppb_generalSettings = get_option('wppb_general_settings', 'not_found' );
4
- if ( ( $wppb_generalSettings != 'not_found' ) && ( $wppb_generalSettings['loginWith'] != 'email' ) )
5
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/username/username.php' );
6
- else{
7
- add_filter( 'wppb_output_display_form_field', 'wppb_remove_username_field_when_login_with_email', 10, 5 );
8
- function wppb_remove_username_field_when_login_with_email( $bool, $field, $form_type, $role, $user_id ){
9
- if( $field['field'] == 'Default - Username' )
10
- return false;
 
11
 
12
- return $bool;
13
- }
14
- }
15
-
16
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/first-name/first-name.php' );
17
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/last-name/last-name.php' );
18
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/password/password.php' );
19
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/password-repeat/password-repeat.php' );
20
 
21
- // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
22
- if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
23
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/aim/aim.php' );
24
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/yim/yim.php' );
25
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/jabber/jabber.php' );
26
- }
27
 
28
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/nickname/nickname.php' );
29
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/description/description.php' );
30
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/website/website.php' );
31
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/email/email.php' );
32
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/display-name/display-name.php' );
33
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/headings/name.php' );
34
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/headings/contact-info.php' );
35
- include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/headings/about-yourself.php' );
 
 
 
 
 
 
 
 
 
1
  <?php
2
  // include individual modules
3
+ function wppb_include_default_fields_files() {
4
+ $wppb_generalSettings = get_option('wppb_general_settings', 'not_found' );
5
+ if ( ( $wppb_generalSettings != 'not_found' ) && ( $wppb_generalSettings['loginWith'] != 'email' ) )
6
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/username/username.php' );
7
+ else{
8
+ add_filter( 'wppb_output_display_form_field', 'wppb_remove_username_field_when_login_with_email', 10, 5 );
9
+ function wppb_remove_username_field_when_login_with_email( $bool, $field, $form_type, $role, $user_id ){
10
+ if( $field['field'] == 'Default - Username' )
11
+ return false;
12
 
13
+ return $bool;
14
+ }
15
+ }
 
 
 
 
 
16
 
17
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/first-name/first-name.php' );
18
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/last-name/last-name.php' );
19
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/password/password.php' );
20
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/password-repeat/password-repeat.php' );
 
 
21
 
22
+ // Default contact methods were removed in WP 3.6. A filter dictates contact methods.
23
+ if ( apply_filters( 'wppb_remove_default_contact_methods', get_site_option( 'initial_db_version' ) < 23588 ) ){
24
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/aim/aim.php' );
25
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/yim/yim.php' );
26
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/jabber/jabber.php' );
27
+ }
28
+
29
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/nickname/nickname.php' );
30
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/description/description.php' );
31
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/website/website.php' );
32
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/email/email.php' );
33
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/display-name/display-name.php' );
34
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/headings/name.php' );
35
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/headings/contact-info.php' );
36
+ include_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/headings/about-yourself.php' );
37
+ }
38
+ wppb_include_default_fields_files();
front-end/default-fields/email/email.php CHANGED
@@ -69,16 +69,24 @@ function wppb_check_email_value( $message, $field, $request_data, $form_location
69
  }
70
  }
71
  }
72
-
73
  $users = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email'] ) );
 
74
  if ( !empty( $users ) ){
75
  if ( $form_location == 'register' )
76
  return __( 'This email is already in use.', 'profile-builder' ) .'<br/>'. __( 'Please try a different one!', 'profile-builder' );
77
 
78
  if ( $form_location == 'edit_profile' ){
79
- if( isset( $_GET['edit_user'] ) && ! empty( $_GET['edit_user'] ) )
 
 
 
 
 
80
  $current_user_id = $_GET['edit_user'];
81
- else{
 
 
82
  $current_user = wp_get_current_user();
83
  $current_user_id = $current_user->ID;
84
  }
@@ -95,10 +103,11 @@ add_filter( 'wppb_check_form_field_default-e-mail', 'wppb_check_email_value', 10
95
  /* handle field save */
96
  function wppb_userdata_add_email( $userdata, $global_request ){
97
  // apply filter to allow stripping slashes if necessary
98
- $global_request['email'] = apply_filters( 'wppb_before_processing_email_from_forms', $global_request['email'] );
99
- if ( isset( $global_request['email'] ) )
100
- $userdata['user_email'] = sanitize_text_field( trim( $global_request['email'] ) );
101
-
 
102
  return $userdata;
103
  }
104
  add_filter( 'wppb_build_userdata', 'wppb_userdata_add_email', 10, 2 );
69
  }
70
  }
71
  }
72
+
73
  $users = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email'] ) );
74
+
75
  if ( !empty( $users ) ){
76
  if ( $form_location == 'register' )
77
  return __( 'This email is already in use.', 'profile-builder' ) .'<br/>'. __( 'Please try a different one!', 'profile-builder' );
78
 
79
  if ( $form_location == 'edit_profile' ){
80
+ $url_parts = parse_url( $_SERVER['HTTP_REFERER'] );
81
+ if( isset( $url_parts['query'] ) ) {
82
+ parse_str( $url_parts['query'], $query );
83
+ }
84
+
85
+ if( isset( $_GET['edit_user'] ) && ! empty( $_GET['edit_user'] ) ) {
86
  $current_user_id = $_GET['edit_user'];
87
+ } elseif( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $query['edit_user'] ) && ! empty( $query['edit_user'] ) ) {
88
+ $current_user_id = $query['edit_user'];
89
+ } else {
90
  $current_user = wp_get_current_user();
91
  $current_user_id = $current_user->ID;
92
  }
103
  /* handle field save */
104
  function wppb_userdata_add_email( $userdata, $global_request ){
105
  // apply filter to allow stripping slashes if necessary
106
+ if ( isset( $global_request['email'] ) ) {
107
+ $global_request['email'] = apply_filters( 'wppb_before_processing_email_from_forms', $global_request['email'] );
108
+ $userdata['user_email'] = sanitize_text_field( trim( $global_request['email'] ) );
109
+ }
110
+
111
  return $userdata;
112
  }
113
  add_filter( 'wppb_build_userdata', 'wppb_userdata_add_email', 10, 2 );
front-end/register.php CHANGED
@@ -107,6 +107,7 @@ function wppb_activate_signup( $key ) {
107
  $meta['user_pass'] = wp_hash_password( $meta['user_pass'] );
108
 
109
  $wpdb->update( $wpdb->users, array('user_pass' => $meta['user_pass'] ), array('ID' => $user_id) );
 
110
  }
111
 
112
  wppb_notify_user_registration_email($bloginfo, $user_login, $user_email, 'sending', $password, $wppb_generalSettings['adminApproval']);
107
  $meta['user_pass'] = wp_hash_password( $meta['user_pass'] );
108
 
109
  $wpdb->update( $wpdb->users, array('user_pass' => $meta['user_pass'] ), array('ID' => $user_id) );
110
+ wp_cache_delete( $user_id, 'users' );
111
  }
112
 
113
  wppb_notify_user_registration_email($bloginfo, $user_login, $user_email, 'sending', $password, $wppb_generalSettings['adminApproval']);
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Profile Builder
4
  Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
- Version: 2.5.0
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8
  Author URI: https://www.cozmoslabs.com/
9
  License: GPL2
@@ -73,7 +73,7 @@ function wppb_free_plugin_init() {
73
  *
74
  *
75
  */
76
- define('PROFILE_BUILDER_VERSION', '2.5.0' );
77
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
78
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79
  define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
3
  Plugin Name: Profile Builder
4
  Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
+ Version: 2.5.1
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8
  Author URI: https://www.cozmoslabs.com/
9
  License: GPL2
73
  *
74
  *
75
  */
76
+ define('PROFILE_BUILDER_VERSION', '2.5.1' );
77
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
78
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79
  define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: user registration, user registration form, user fields, extra user fields,
5
 
6
  Requires at least: 3.1
7
  Tested up to: 4.6.1
8
- Stable tag: 2.5.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -150,6 +150,11 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
150
  10. Profile Builder Login Widget
151
 
152
  == Changelog ==
 
 
 
 
 
153
  = 2.5.0 =
154
  * We now delete cache when updating a user with email confirmation so solve issues with cache-ing plugins
155
  * Fixed select2 JS error when select2 addon is inactive but select2 fields are still in front-end.
5
 
6
  Requires at least: 3.1
7
  Tested up to: 4.6.1
8
+ Stable tag: 2.5.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
150
  10. Profile Builder Login Widget
151
 
152
  == Changelog ==
153
+ = 2.5.1 =
154
+ * Improvements regarding caching plugins and user registration
155
+ * Added a search field in the admin area on the Users with unconfirmed email address screen
156
+ * Improved queries for displaying users in the admin area on the Users with unconfirmed email address screen
157
+
158
  = 2.5.0 =
159
  * We now delete cache when updating a user with email confirmation so solve issues with cache-ing plugins
160
  * Fixed select2 JS error when select2 addon is inactive but select2 fields are still in front-end.