User registration & user profile – Profile Builder - Version 2.3.1

Version Description

  • Refactored username exists check to search only in username
  • Fixed issue when there was a meta in the db with no meta key and we couldn't add our fields that had no meta key because it would generate meta name already in use
  • Fixed conflict with WPMUDEV Set Password plugin with which we had a function with the same name
Download this release

Release Info

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

Code changes from version 2.3.0 to 2.3.1

admin/manage-fields.php CHANGED
@@ -714,9 +714,11 @@ function wppb_check_field_on_edit_add( $message, $fields, $required_fields, $met
714
  }
715
 
716
  if ( $found_in_custom_fields === false ){
717
- $found_meta_name = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name'] ) );
718
- if ( $found_meta_name != null )
719
- $message .= __( "That meta-name is already in use\n", 'profile-builder' );
 
 
720
  }
721
  }
722
  }
714
  }
715
 
716
  if ( $found_in_custom_fields === false ){
717
+ if( $posted_values['meta-name'] != '' ) {
718
+ $found_meta_name = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE meta_key = %s", $posted_values['meta-name']));
719
+ if ($found_meta_name != null)
720
+ $message .= __("That meta-name is already in use\n", 'profile-builder');
721
+ }
722
  }
723
  }
724
  }
front-end/class-formbuilder.php CHANGED
@@ -329,7 +329,7 @@ class Profile_Builder_Form_Creator{
329
  echo $message;
330
 
331
  // use this action hook to add extra content before the register form
332
- do_action( 'wppb_before_'.$this->args['form_type'].'_fields' );
333
  ?>
334
  <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';?>" action="<?php echo apply_filters( 'wppb_form_action', '' ); ?>">
335
  <?php
@@ -365,7 +365,7 @@ class Profile_Builder_Form_Creator{
365
  </form>
366
  <?php
367
  // use this action hook to add extra content after the register form
368
- do_action( 'wppb_after_'. $this->args['form_type'] .'_fields' );
369
 
370
  }
371
 
329
  echo $message;
330
 
331
  // use this action hook to add extra content before the register form
332
+ do_action( 'wppb_before_'.$this->args['form_type'].'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );
333
  ?>
334
  <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';?>" action="<?php echo apply_filters( 'wppb_form_action', '' ); ?>">
335
  <?php
365
  </form>
366
  <?php
367
  // use this action hook to add extra content after the register form
368
+ do_action( 'wppb_after_'. $this->args['form_type'] .'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );
369
 
370
  }
371
 
front-end/default-fields/username/username.php CHANGED
@@ -44,14 +44,14 @@ function wppb_check_username_value( $message, $field, $request_data, $form_locat
44
  }
45
 
46
  if( !empty( $request_data['username'] ) ){
47
- if( $form_location == 'register' )
48
- $search_by_user_login = get_users( 'search='.$request_data['username'] );
49
- if( !empty( $search_by_user_login ) ){
50
- return __( 'This username already exists.', 'profile-builder' ) .'<br/>'. __( 'Please try a different one!', 'profile-builder' );
 
 
 
51
  }
52
- if( ! validate_username( $request_data['username'] ) ) {
53
- return __( 'This username is invalid because it uses illegal characters.', 'profile-builder' ) .'<br/>'. __( 'Please enter a valid username.', 'profile-builder' );
54
- }
55
 
56
  $wppb_generalSettings = get_option('wppb_general_settings');
57
  if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ){
44
  }
45
 
46
  if( !empty( $request_data['username'] ) ){
47
+ if( $form_location == 'register' ) {
48
+ if( username_exists($request_data['username'] ) ){
49
+ return __('This username already exists.', 'profile-builder') . '<br/>' . __('Please try a different one!', 'profile-builder');
50
+ }
51
+ if (!validate_username($request_data['username'])) {
52
+ return __('This username is invalid because it uses illegal characters.', 'profile-builder') . '<br/>' . __('Please enter a valid username.', 'profile-builder');
53
+ }
54
  }
 
 
 
55
 
56
  $wppb_generalSettings = get_option('wppb_general_settings');
57
  if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ){
front-end/register.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Function that changes the auto generated password with the one selected by the user.
4
  */
5
- function signup_password_random_password_filter( $password ) {
6
  global $wpdb;
7
 
8
  $key = ( !empty( $_GET['key'] ) ? $_GET['key'] : null );
9
- $key = ( !empty( $_POST['key'] ) ? $_POST['key'] : null );
10
 
11
  if ( !empty( $_POST['user_pass'] ) )
12
  $password = $_POST['user_pass'];
@@ -26,7 +26,7 @@ function signup_password_random_password_filter( $password ) {
26
 
27
  return apply_filters( 'wppb_generated_random_password', $password, $key );
28
  }
29
- add_filter( 'random_password', 'signup_password_random_password_filter' );
30
 
31
  /**
32
  * Activate a signup.
2
  /**
3
  * Function that changes the auto generated password with the one selected by the user.
4
  */
5
+ function wppb_signup_password_random_password_filter( $password ) {
6
  global $wpdb;
7
 
8
  $key = ( !empty( $_GET['key'] ) ? $_GET['key'] : null );
9
+ $key = ( !empty( $_POST['key'] ) ? $_POST['key'] : $key );
10
 
11
  if ( !empty( $_POST['user_pass'] ) )
12
  $password = $_POST['user_pass'];
26
 
27
  return apply_filters( 'wppb_generated_random_password', $password, $key );
28
  }
29
+ add_filter( 'random_password', 'wppb_signup_password_random_password_filter' );
30
 
31
  /**
32
  * Activate a signup.
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://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.3.0
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8
  Author URI: http://www.cozmoslabs.com/
9
  License: GPL2
@@ -73,7 +73,7 @@ function wppb_free_plugin_init() {
73
  *
74
  *
75
  */
76
- define('PROFILE_BUILDER_VERSION', '2.3.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: http://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.3.1
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel, Mihai Iova
8
  Author URI: http://www.cozmoslabs.com/
9
  License: GPL2
73
  *
74
  *
75
  */
76
+ define('PROFILE_BUILDER_VERSION', '2.3.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: registration, user profile, user registration, custom field registration,
5
 
6
  Requires at least: 3.1
7
  Tested up to: 4.4.2
8
- Stable tag: 2.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -115,6 +115,11 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
115
  10. Profile Builder Login Widget
116
 
117
  == Changelog ==
 
 
 
 
 
118
  = 2.3.0 =
119
  * Added filter in login form so we can display html at the bottom
120
  * Fixed a filter in login redirect link that was broken
5
 
6
  Requires at least: 3.1
7
  Tested up to: 4.4.2
8
+ Stable tag: 2.3.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
115
  10. Profile Builder Login Widget
116
 
117
  == Changelog ==
118
+ = 2.3.1 =
119
+ * Refactored username exists check to search only in username
120
+ * Fixed issue when there was a meta in the db with no meta key and we couldn't add our fields that had no meta key because it would generate meta name already in use
121
+ * Fixed conflict with WPMUDEV Set Password plugin with which we had a function with the same name
122
+
123
  = 2.3.0 =
124
  * Added filter in login form so we can display html at the bottom
125
  * Fixed a filter in login redirect link that was broken