User registration & user profile – Profile Builder - Version 2.7.3

Version Description

  • Now we save the registration date only in GMT time to avoid confusions. We have a filter to be able to save to local time: wppb_return_local_time_for_register
  • Added functionality to update meta name for existing fields in the database if they change. It is off by default but can be activated with the filter wppb_update_field_meta_key_in_db
  • Added a mention to Roles Editor in the Basic Info Page
Download this release

Release Info

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

Code changes from version 2.7.2 to 2.7.3

admin/basic-info.php CHANGED
@@ -77,6 +77,10 @@ function wppb_basic_info_content() {
77
  <h3><?php _e( 'Login with Email or Username', 'profile-builder' ); ?></h3>
78
  <p><?php _e( 'Allow users to log in with their email or username when accessing your site.', 'profile-builder' ); ?></p>
79
  </div>
 
 
 
 
80
  </div>
81
 
82
  <?php
77
  <h3><?php _e( 'Login with Email or Username', 'profile-builder' ); ?></h3>
78
  <p><?php _e( 'Allow users to log in with their email or username when accessing your site.', 'profile-builder' ); ?></p>
79
  </div>
80
+ <div style="clear:left;">
81
+ <h3><?php _e( 'Roles Editor', 'profile-builder' ); ?></h3>
82
+ <p><?php _e( 'Add, remove, clone and edit roles and also capabilities for these roles.', 'profile-builder' ); ?></p>
83
+ </div>
84
  </div>
85
 
86
  <?php
admin/manage-fields.php CHANGED
@@ -112,12 +112,20 @@ function wppb_manage_fields_submenu(){
112
  //cpt select
113
  $post_types = get_post_types( array( 'public' => true ), 'names' );
114
 
 
 
 
 
 
 
 
 
115
  // set up the fields array
116
  $fields = apply_filters( 'wppb_manage_fields', array(
117
 
118
  array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profile-builder' ), 'description' => __( 'Title of the field', 'profile-builder' ) ),
119
  array( 'type' => 'select', 'slug' => 'field', 'title' => __( 'Field', 'profile-builder' ), 'options' => apply_filters( 'wppb_manage_fields_types', $manage_field_types ), 'default-option' => true, 'description' => $field_description ),
120
- array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profile-builder' ), 'default' => wppb_get_meta_name(), 'description' => __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this might take long in case of a very big user-count', 'profile-builder' ) ),
121
  array( 'type' => 'text', 'slug' => 'id', 'title' => __( 'ID', 'profile-builder' ), 'default' => wppb_get_unique_id(), 'description' => __( "A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profile-builder' ), 'readonly' => true ),
122
  array( 'type' => 'textarea', 'slug' => 'description', 'title' => __( 'Description', 'profile-builder' ), 'description' => __( 'Enter a (detailed) description of the option for end users to read<br/>Optional', 'profile-builder') ),
123
  array( 'type' => 'text', 'slug' => 'row-count', 'title' => __( 'Row Count', 'profile-builder' ), 'default' => 5, 'description' => __( "Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profile-builder' ) ),
@@ -1379,3 +1387,26 @@ function wppb_redisable_the_add_button(){
1379
  <script>wppb_disable_add_entry_button ( '#wppb_manage_fields' );</script>
1380
  <?php
1381
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  //cpt select
113
  $post_types = get_post_types( array( 'public' => true ), 'names' );
114
 
115
+
116
+ if( apply_filters( 'wppb_update_field_meta_key_in_db', false ) ) {
117
+ $meta_key_description = __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this might take long in case of a very big user-count', 'profile-builder' );
118
+ }
119
+ else{
120
+ $meta_key_description = __( 'Use this in conjunction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be unique)<br/>Changing this will only affect subsequent entries', 'profile-builder' );
121
+ }
122
+
123
  // set up the fields array
124
  $fields = apply_filters( 'wppb_manage_fields', array(
125
 
126
  array( 'type' => 'text', 'slug' => 'field-title', 'title' => __( 'Field Title', 'profile-builder' ), 'description' => __( 'Title of the field', 'profile-builder' ) ),
127
  array( 'type' => 'select', 'slug' => 'field', 'title' => __( 'Field', 'profile-builder' ), 'options' => apply_filters( 'wppb_manage_fields_types', $manage_field_types ), 'default-option' => true, 'description' => $field_description ),
128
+ array( 'type' => 'text', 'slug' => 'meta-name', 'title' => __( 'Meta-name', 'profile-builder' ), 'default' => wppb_get_meta_name(), 'description' => $meta_key_description ),
129
  array( 'type' => 'text', 'slug' => 'id', 'title' => __( 'ID', 'profile-builder' ), 'default' => wppb_get_unique_id(), 'description' => __( "A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profile-builder' ), 'readonly' => true ),
130
  array( 'type' => 'textarea', 'slug' => 'description', 'title' => __( 'Description', 'profile-builder' ), 'description' => __( 'Enter a (detailed) description of the option for end users to read<br/>Optional', 'profile-builder') ),
131
  array( 'type' => 'text', 'slug' => 'row-count', 'title' => __( 'Row Count', 'profile-builder' ), 'default' => 5, 'description' => __( "Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profile-builder' ) ),
1387
  <script>wppb_disable_add_entry_button ( '#wppb_manage_fields' );</script>
1388
  <?php
1389
  }
1390
+
1391
+
1392
+ /**
1393
+ * Function that updates the meta_key of a field in the usertmeta table when it was changed for a field. It is turned off by default
1394
+ */
1395
+ add_action( 'wck_before_update_meta', 'wppb_change_field_meta_key', 10, 4 );
1396
+ function wppb_change_field_meta_key( $meta, $id, $values, $element_id ){
1397
+ if( apply_filters( 'wppb_update_field_meta_key_in_db', false ) ) {
1398
+ if ($meta == 'wppb_manage_fields') {
1399
+ global $wpdb;
1400
+ $wppb_manage_fields = get_option('wppb_manage_fields');
1401
+ if (!empty($wppb_manage_fields)) {
1402
+ if (!empty($values['meta-name']) && $wppb_manage_fields[$element_id]['meta-name'] != $values['meta-name']) {
1403
+ $wpdb->update(
1404
+ $wpdb->usermeta,
1405
+ array('meta_key' => sanitize_text_field($values['meta-name'])),
1406
+ array('meta_key' => sanitize_text_field($wppb_manage_fields[$element_id]['meta-name']))
1407
+ );
1408
+ }
1409
+ }
1410
+ }
1411
+ }
1412
+ }
features/email-confirmation/class-email-confirmation.php CHANGED
@@ -74,7 +74,7 @@ class wpp_list_unfonfirmed_email_table extends PB_WP_List_Table {
74
  switch($column_name){
75
  case 'email':
76
  case 'registered':
77
- return $item[$column_name];
78
  case 'user-meta':
79
  global $wpdb;
80
  $sql_result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", $item['email'] ), ARRAY_A );
74
  switch($column_name){
75
  case 'email':
76
  case 'registered':
77
+ return date_i18n( "Y-m-d G:i:s", wppb_add_gmt_offset( strtotime( $item[$column_name] ) ) );
78
  case 'user-meta':
79
  global $wpdb;
80
  $sql_result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->base_prefix . "signups WHERE user_email = %s", $item['email'] ), ARRAY_A );
features/email-confirmation/email-confirmation.php CHANGED
@@ -331,7 +331,7 @@ function wppb_signup_user( $username, $user_email, $meta = '' ) {
331
  $meta = serialize( $meta );
332
 
333
  // change User Registered date and time according to timezone selected in WordPress settings
334
- $wppb_get_date = wppb_get_date_by_timezone();
335
 
336
  if( isset( $wppb_get_date ) ) {
337
  $wppb_user_registered = $wppb_get_date;
331
  $meta = serialize( $meta );
332
 
333
  // change User Registered date and time according to timezone selected in WordPress settings
334
+ $wppb_get_date = wppb_get_register_date();
335
 
336
  if( isset( $wppb_get_date ) ) {
337
  $wppb_user_registered = $wppb_get_date;
features/functions.php CHANGED
@@ -783,21 +783,30 @@ function wppb_handle_meta_name( $meta_name ){
783
 
784
 
785
  // change User Registered date and time according to timezone selected in WordPress settings
786
- function wppb_get_date_by_timezone() {
787
- $wppb_wp_timezone = get_option( 'timezone_string' );
788
 
789
- if( ! empty( $wppb_wp_timezone ) ) {
790
- date_default_timezone_set( $wppb_wp_timezone );
791
- $wppb_get_date = date( "Y-m-d G:i:s" );
792
- } else {
793
- $wppb_wp_gmt_offset = get_option( 'gmt_offset' );
794
- $wppb_gmt_offset = $wppb_wp_gmt_offset * 60 * 60;
795
- $wppb_get_date = gmdate( "Y-m-d G:i:s", time() + $wppb_gmt_offset );
796
  }
797
 
798
  return $wppb_get_date;
799
  }
800
 
 
 
 
 
 
 
 
 
 
 
 
 
801
  /**
802
  * Add HTML tag 'required' to fields
803
  *
783
 
784
 
785
  // change User Registered date and time according to timezone selected in WordPress settings
786
+ function wppb_get_register_date() {
 
787
 
788
+ $time_format = "Y-m-d G:i:s";
789
+ $wppb_get_date = date_i18n( $time_format, false, true );
790
+
791
+ if( apply_filters( 'wppb_return_local_time_for_register', false ) ){
792
+ $wppb_get_date = date_i18n( $time_format );
 
 
793
  }
794
 
795
  return $wppb_get_date;
796
  }
797
 
798
+ /**
799
+ * Function that ads the gmt offset from the general settings to a unix timestamp
800
+ * @param $timestamp
801
+ * @return mixed
802
+ */
803
+ function wppb_add_gmt_offset( $timestamp ) {
804
+ if( apply_filters( 'wppb_add_gmt_offset', true ) ){
805
+ $timestamp = $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
806
+ }
807
+ return $timestamp;
808
+ }
809
+
810
  /**
811
  * Add HTML tag 'required' to fields
812
  *
front-end/class-formbuilder.php CHANGED
@@ -602,7 +602,7 @@ class Profile_Builder_Form_Creator{
602
  $userdata = wp_unslash( $userdata );
603
 
604
  // change User Registered date and time according to timezone selected in WordPress settings
605
- $wppb_get_date = wppb_get_date_by_timezone();
606
 
607
  if( isset( $wppb_get_date ) ) {
608
  $userdata['user_registered'] = $wppb_get_date;
602
  $userdata = wp_unslash( $userdata );
603
 
604
  // change User Registered date and time according to timezone selected in WordPress settings
605
+ $wppb_get_date = wppb_get_register_date();
606
 
607
  if( isset( $wppb_get_date ) ) {
608
  $userdata['user_registered'] = $wppb_get_date;
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.7.2
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.7.2' );
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.7.3
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.7.3' );
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
@@ -4,7 +4,7 @@ Donate link: http://www.cozmoslabs.com/wordpress-profile-builder/
4
  Tags: user registration, user profile, user registration form, user fields, extra user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form, content restriction, restrict content
5
  Requires at least: 3.1
6
  Tested up to: 4.9.1
7
- Stable tag: 2.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -163,6 +163,11 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
163
  12. Role Editor
164
 
165
  == Changelog ==
 
 
 
 
 
166
  = 2.7.2 =
167
  * Updated translation file.
168
  * Fixed issue with login token generating duplicated ID validation error
4
  Tags: user registration, user profile, user registration form, user fields, extra user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form, content restriction, restrict content
5
  Requires at least: 3.1
6
  Tested up to: 4.9.1
7
+ Stable tag: 2.7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
163
  12. Role Editor
164
 
165
  == Changelog ==
166
+ = 2.7.3 =
167
+ * Now we save the registration date only in GMT time to avoid confusions. We have a filter to be able to save to local time: wppb_return_local_time_for_register
168
+ * Added functionality to update meta name for existing fields in the database if they change. It is off by default but can be activated with the filter wppb_update_field_meta_key_in_db
169
+ * Added a mention to Roles Editor in the Basic Info Page
170
+
171
  = 2.7.2 =
172
  * Updated translation file.
173
  * Fixed issue with login token generating duplicated ID validation error