User registration & user profile – Profile Builder - Version 3.0.0

Version Description

  • Security improvements
  • Added a filter for the Register and Edit Profile forms.
Download this release

Release Info

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

Code changes from version 2.9.9 to 3.0.0

admin/manage-fields.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
  /**
3
  * Function that creates the Manage Fields submenu and populates it with a repeater field form
4
  *
@@ -121,22 +126,24 @@ function wppb_populate_manage_fields(){
121
  $field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) );
122
  }
123
 
124
-
125
  //user roles
126
  global $wp_roles;
127
 
 
128
  $user_roles = array();
129
  foreach( $wp_roles->roles as $user_role_slug => $user_role )
130
  if( $user_role_slug !== 'administrator' )
131
  array_push( $user_roles, '%' . $user_role['name'] . '%' . $user_role_slug );
132
 
133
 
 
134
  // country select
135
  $default_country_array = wppb_country_select_options( 'back_end' );
136
  foreach( $default_country_array as $iso_country_code => $country_name ) {
137
  $default_country_options[] = '%'.$country_name.'%'.$iso_country_code;
138
  }
139
 
 
140
  // currency select
141
  $default_currency_array = wppb_get_currencies( 'back_end' );
142
  array_unshift( $default_currency_array, '' );
@@ -155,6 +162,14 @@ function wppb_populate_manage_fields(){
155
  $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' );
156
  }
157
 
 
 
 
 
 
 
 
 
158
  // set up the fields array
159
  $fields = apply_filters( 'wppb_manage_fields', array(
160
 
@@ -190,9 +205,29 @@ function wppb_populate_manage_fields(){
190
  array( 'type' => 'text', 'slug' => 'custom-error-message', 'title' => __( 'Error Message', 'profile-builder' ), 'description' => __( "Set a custom error message that will be displayed to the user.", 'profile-builder' ) ),
191
  array( 'type' => 'select', 'slug' => 'time-format', 'title' => __( 'Time Format', 'profile-builder' ), 'options' => array( '%12 Hours%12', '%24 Hours%24' ), 'description' => __( 'Specify the time format.', 'profile-builder' ) ),
192
  array( 'type' => 'text', 'slug' => 'map-api-key', 'title' => __( 'Google Maps API Key', 'profile-builder' ), 'description' => __( 'Enter your Google Maps API key ( <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend" target="_blank">Get your API key</a> ). If more than one map fields are added to a form the API key from the first map displayed will be used.', 'profile-builder' ) ),
193
- array( 'type' => 'text', 'slug' => 'map-default-lat', 'title' => __( 'Default Latitude', 'profile-builder' ), 'description' => __( "The latitude at which the map should be displayed when no pins are attached.", 'profile-builder' ) ),
194
- array( 'type' => 'text', 'slug' => 'map-default-lng', 'title' => __( 'Default Longitude', 'profile-builder' ), 'description' => __( "The longitude at which the map should be displayed when no pins are attached.", 'profile-builder' ) ),
195
- array( 'type' => 'text', 'slug' => 'map-default-zoom', 'title' => __( 'Default Zoom Level', 'profile-builder' ), 'description' => __( "Add a number from 0 to 19. The higher the number the higher the zoom.", 'profile-builder' ), 'default' => 16 ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  array( 'type' => 'text', 'slug' => 'map-height', 'title' => __( 'Map Height', 'profile-builder' ), 'description' => __( "The height of the map.", 'profile-builder' ), 'default' => 400 ),
197
  array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profile-builder' ), 'description' => __( "Default value of the textarea", 'profile-builder' ) ),
198
  array( 'type' => 'textarea', 'slug' => 'html-content', 'title' => __( 'HTML Content', 'profile-builder' ), 'description' => __( "Add your HTML (or text) content", 'profile-builder' ) ),
@@ -203,7 +238,43 @@ function wppb_populate_manage_fields(){
203
  array( 'type' => 'text', 'slug' => 'number-step-value', 'title' => __( 'Number Step Value', 'profile-builder' ), 'description' => __( "Step value 1 to allow only integers, 0.1 to allow integers and numbers with 1 decimal", 'profile-builder' ) .'<br>'. __( "To allow multiple decimals use for eg. 0.01 (for 2 deciamls) and so on", 'profile-builder' ) .'<br>'. __( "You can also use step value to specify the legal number intervals (eg. step value 2 will allow only -4, -2, 0, 2 and so on)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no restriction", 'profile-builder' ) ),
204
  array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ),
205
  array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ),
206
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
  // create the new submenu with the above options
209
  $args = array(
@@ -995,6 +1066,7 @@ function wppb_return_unique_field_list( $only_default_fields = false ){
995
  $unique_field_list[] = 'Avatar';
996
  $unique_field_list[] = 'reCAPTCHA';
997
  $unique_field_list[] = 'Select (User Role)';
 
998
  }
999
 
1000
  return apply_filters ( 'wppb_unique_field_list', $unique_field_list );
@@ -1356,21 +1428,42 @@ function wppb_get_map_output( $field, $args ) {
1356
 
1357
  $return = '';
1358
 
1359
- // Search box
1360
- // The style:left=-99999px is set to hide the input from the viewport. It will be rewritten when the map gets initialised
1361
- if( $args['show_search'] )
1362
- $return .= '<input style="left: -99999px" type="text" id="' . $field['meta-name'] . '-search-box" class="wppb-map-search-box" placeholder="' . __( 'Search Location', 'profile-builder' ) . '" />';
1363
-
1364
- // Map container
1365
- $return .= '<div id="' . $field['meta-name'] . '" class="wppb-map-container" style="height: ' . $field['map-height'] . 'px;" data-editable="' . ( $args['editable'] ? 1 : 0 ) . '" data-default-zoom="' . ( !empty( $field['map-default-zoom'] ) ? (int)$field['map-default-zoom'] : 16 ) . '" data-default-lat="' . $field['map-default-lat'] . '" data-default-lng="' . $field['map-default-lng'] . '" ' . $args['extra_attr'] . '></div>';
1366
 
1367
- if( !empty( $args['markers'] ) ) {
1368
- foreach( $args['markers'] as $marker )
1369
- $return .= '<input name="' . $field['meta-name'] . '[]" type="hidden" class="wppb-map-marker" value="' . $marker . '" />';
1370
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1371
 
1372
- return $return;
 
 
1373
 
 
1374
  }
1375
 
1376
 
@@ -1450,3 +1543,50 @@ function wppb_change_field_meta_key( $meta, $id, $values, $element_id ){
1450
  }
1451
  }
1452
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ // Define the default values.
3
+ define( 'WPPB_DEFAULTS_MAP_LAT', 48 );
4
+ define( 'WPPB_DEFAULTS_MAP_LNG', 12 );
5
+ define( 'WPPB_DEFAULTS_MAP_ZOOM', 4 );
6
+
7
  /**
8
  * Function that creates the Manage Fields submenu and populates it with a repeater field form
9
  *
126
  $field_description .= sprintf( __('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.' , 'profile-builder'), esc_url( 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree' ) );
127
  }
128
 
 
129
  //user roles
130
  global $wp_roles;
131
 
132
+ // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
133
  $user_roles = array();
134
  foreach( $wp_roles->roles as $user_role_slug => $user_role )
135
  if( $user_role_slug !== 'administrator' )
136
  array_push( $user_roles, '%' . $user_role['name'] . '%' . $user_role_slug );
137
 
138
 
139
+ // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
140
  // country select
141
  $default_country_array = wppb_country_select_options( 'back_end' );
142
  foreach( $default_country_array as $iso_country_code => $country_name ) {
143
  $default_country_options[] = '%'.$country_name.'%'.$iso_country_code;
144
  }
145
 
146
+ // @TODO - The block below could use refactoring, see new function wppb_prepare_key_value_options.
147
  // currency select
148
  $default_currency_array = wppb_get_currencies( 'back_end' );
149
  array_unshift( $default_currency_array, '' );
162
  $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' );
163
  }
164
 
165
+ // Initiate the list of available tags for the pin bubble.
166
+ if( function_exists( 'wppb_generate_userlisting_merge_tags' ) ) {
167
+ $bubble_meta_tags = wppb_generate_userlisting_merge_tags('meta');
168
+ $bubble_meta_tags = wp_list_pluck($bubble_meta_tags, 'label', 'name');
169
+ }
170
+ else
171
+ $bubble_meta_tags = array();
172
+
173
  // set up the fields array
174
  $fields = apply_filters( 'wppb_manage_fields', array(
175
 
205
  array( 'type' => 'text', 'slug' => 'custom-error-message', 'title' => __( 'Error Message', 'profile-builder' ), 'description' => __( "Set a custom error message that will be displayed to the user.", 'profile-builder' ) ),
206
  array( 'type' => 'select', 'slug' => 'time-format', 'title' => __( 'Time Format', 'profile-builder' ), 'options' => array( '%12 Hours%12', '%24 Hours%24' ), 'description' => __( 'Specify the time format.', 'profile-builder' ) ),
207
  array( 'type' => 'text', 'slug' => 'map-api-key', 'title' => __( 'Google Maps API Key', 'profile-builder' ), 'description' => __( 'Enter your Google Maps API key ( <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend" target="_blank">Get your API key</a> ). If more than one map fields are added to a form the API key from the first map displayed will be used.', 'profile-builder' ) ),
208
+
209
+ array(
210
+ 'type' => 'text',
211
+ 'slug' => 'map-default-lat',
212
+ 'title' => __( 'Default Latitude', 'profile-builder' ),
213
+ 'description' => __( 'The latitude at which the map should be displayed when no pins are attached.', 'profile-builder' ),
214
+ 'default' => WPPB_DEFAULTS_MAP_LAT,
215
+ ),
216
+ array(
217
+ 'type' => 'text',
218
+ 'slug' => 'map-default-lng',
219
+ 'title' => __( 'Default Longitude', 'profile-builder' ),
220
+ 'description' => __( 'The longitude at which the map should be displayed when no pins are attached.', 'profile-builder' ),
221
+ 'default' => WPPB_DEFAULTS_MAP_LNG,
222
+ ),
223
+ array(
224
+ 'type' => 'text',
225
+ 'slug' => 'map-default-zoom',
226
+ 'title' => __( 'Default Zoom Level', 'profile-builder' ),
227
+ 'description' => __( 'Add a number from 0 to 19. The higher the number the higher the zoom.', 'profile-builder' ),
228
+ 'default' => WPPB_DEFAULTS_MAP_ZOOM,
229
+ ),
230
+
231
  array( 'type' => 'text', 'slug' => 'map-height', 'title' => __( 'Map Height', 'profile-builder' ), 'description' => __( "The height of the map.", 'profile-builder' ), 'default' => 400 ),
232
  array( 'type' => 'textarea', 'slug' => 'default-content', 'title' => __( 'Default Content', 'profile-builder' ), 'description' => __( "Default value of the textarea", 'profile-builder' ) ),
233
  array( 'type' => 'textarea', 'slug' => 'html-content', 'title' => __( 'HTML Content', 'profile-builder' ), 'description' => __( "Add your HTML (or text) content", 'profile-builder' ) ),
238
  array( 'type' => 'text', 'slug' => 'number-step-value', 'title' => __( 'Number Step Value', 'profile-builder' ), 'description' => __( "Step value 1 to allow only integers, 0.1 to allow integers and numbers with 1 decimal", 'profile-builder' ) .'<br>'. __( "To allow multiple decimals use for eg. 0.01 (for 2 deciamls) and so on", 'profile-builder' ) .'<br>'. __( "You can also use step value to specify the legal number intervals (eg. step value 2 will allow only -4, -2, 0, 2 and so on)", 'profile-builder' ) .'<br>'. __( "Leave it empty for no restriction", 'profile-builder' ) ),
239
  array( 'type' => 'select', 'slug' => 'required', 'title' => __( 'Required', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( 'Whether the field is required or not', 'profile-builder' ) ),
240
  array( 'type' => 'select', 'slug' => 'overwrite-existing', 'title' => __( 'Overwrite Existing', 'profile-builder' ), 'options' => array( 'No', 'Yes' ), 'default' => 'No', 'description' => __( "Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder' ) ),
241
+
242
+ // Added the new option for the map field type, that allows to customize the POIs load type.
243
+ array(
244
+ 'type' => 'select',
245
+ 'slug' => 'map-pins-load-type',
246
+ 'title' => __( 'POIs Load Type', 'profile-builder' ),
247
+ 'options' => array(
248
+ '%' . __( 'POIs of the listed users (as filtered & paginated)', 'profile-builder' ) . '%',
249
+ '%' . __( 'POIs of all the users for the filter* (no pagination)', 'profile-builder' ) . '%all',
250
+ ),
251
+ 'default' => '',
252
+ 'description' => __( 'This option allows you to load on a single map the POIs for all users, or just these for the listed ones (this will take into account the filters and the faceted menus). *Please use this feature wisely, it will impact the performance.', 'profile-builder' ),
253
+ ),
254
+
255
+ // Added the new option for the map field type, that allows to customize the POI bubble content.
256
+ array(
257
+ 'type' => 'checkbox',
258
+ 'slug' => 'map-bubble-fields',
259
+ 'title' => __( 'POI Bubble Info', 'profile-builder' ),
260
+ 'options' => wppb_prepare_key_value_options( apply_filters( 'wppb_map_bubble_fields', $bubble_meta_tags ) ),
261
+ 'default' => 'avatar_or_gravatar, meta_display_name',
262
+ 'description' => __( 'Select the attributes to be listed inside the POI bubble.', 'profile-builder' ),
263
+ 'extra_attributes' => array(
264
+ 'dropdown_options' => true,
265
+ 'sortable_options' => true,
266
+ ),
267
+ ),
268
+
269
+ // Added the new option for the map field type, that allows to customize the number of users per iteration.
270
+ array(
271
+ 'type' => 'text',
272
+ 'slug' => 'map-pagination-number',
273
+ 'title' => __( 'Number of Users per Map Iteration', 'profile-builder' ),
274
+ 'description' => __( 'When loading the map of all users with no pagination, the map script will iterate multiple times and will expose gradually POIs on the map, until all the POIs for the users that match the criteria will be added on the map (think of this as of pagination for the map POIs). The smaller the number of users per iteration, the fastest the iteration response will be, but for a large number of users, the map script will iterate multiple times. Setting a higher limit will decrease the performance, but might produce a smaller number of iterations. <br><br><b>Please adjust this value to your hosting capabilities, and make sure that the value you set is the best for performance.</b> We recommend a <b>maximum</b> value of 300.', 'profile-builder' ),
275
+ 'default' => 50,
276
+ ),
277
+ ) );
278
 
279
  // create the new submenu with the above options
280
  $args = array(
1066
  $unique_field_list[] = 'Avatar';
1067
  $unique_field_list[] = 'reCAPTCHA';
1068
  $unique_field_list[] = 'Select (User Role)';
1069
+ $unique_field_list[] = 'Map';
1070
  }
1071
 
1072
  return apply_filters ( 'wppb_unique_field_list', $unique_field_list );
1428
 
1429
  $return = '';
1430
 
1431
+ // Search box
1432
+ // The style:left=-99999px is set to hide the input from the viewport. It will be rewritten when the map gets initialised
1433
+ if ( $args['show_search'] ) {
1434
+ $return .= '<input style="left: -99999px" type="text" id="' . $field['meta-name'] . '-search-box" class="wppb-map-search-box" placeholder="' . __( 'Search Location', 'profile-builder' ) . '" />';
1435
+ }
 
 
1436
 
1437
+ $lng = ( ! empty( $field['map-default-lng'] ) ) ? (float) $field['map-default-lng'] : WPPB_DEFAULTS_MAP_LNG;
1438
+ $lat = ( ! empty( $field['map-default-lat'] ) ) ? (float) $field['map-default-lat'] : WPPB_DEFAULTS_MAP_LAT;
1439
+ $zoom = ( ! empty( $field['map-default-zoom'] ) ) ? (int) $field['map-default-zoom'] : WPPB_DEFAULTS_MAP_ZOOM;
1440
+
1441
+ // Get one time the settings.
1442
+ $settings = wppb_options_get_map_settings();
1443
+ $pin_info = ( ! empty( $args['user_id'] ) ) ? wppb_compute_simple_pin_content_for_user( $args['user_id'], $settings ) : '';
1444
+
1445
+ // Map container.
1446
+ $return .= '<div id="' . $field['meta-name'] . '" class="wppb-map-container" style="height: ' . $field['map-height'] . 'px;" data-editable="' . ( $args['editable'] ? 1 : 0 ) . '" data-default-zoom="' . $zoom . '" data-default-lat="' . $lat . '" data-default-lng="' . $lng . '" ' . $args['extra_attr'] . '></div>';
1447
+
1448
+ if ( ! empty( $args['markers'] ) ) {
1449
+ foreach ( $args['markers'] as $marker ) {
1450
+ if ( ! empty( $args['user_id'] ) ) {
1451
+ // Also compute the marker bubble content.
1452
+ $bubble = wppb_get_user_pin_bubble(
1453
+ $args['user_id'],
1454
+ strstr( $marker, ',', true ),
1455
+ ltrim( strstr( $marker, ',' ), ',' ),
1456
+ $pin_info,
1457
+ ''
1458
+ );
1459
+ $return .= $bubble;
1460
+ }
1461
 
1462
+ $return .= '<input name="' . $field['meta-name'] . '[]" type="hidden" class="wppb-map-marker" value="' . $marker . '" />';
1463
+ }
1464
+ }
1465
 
1466
+ return $return;
1467
  }
1468
 
1469
 
1543
  }
1544
  }
1545
  }
1546
+
1547
+
1548
+
1549
+ if ( ! function_exists( 'wppb_prepare_key_value_options' ) ) {
1550
+ /**
1551
+ * Convert an array with keys and values into a usable option for the defined fields types.
1552
+ *
1553
+ * @param arrays $array List of options.
1554
+ * @return array Usable options.
1555
+ */
1556
+ function wppb_prepare_key_value_options( $array = array() ) {
1557
+ $result = array();
1558
+ if ( ! empty( $array ) ) {
1559
+ foreach ( $array as $name => $label ) {
1560
+ $result[] = '%' . $label . '%' . $name;
1561
+ }
1562
+ }
1563
+ return $result;
1564
+ }
1565
+ }
1566
+
1567
+ if ( ! function_exists( 'wppb_filter_map_bubble_fields' ) ) {
1568
+ /**
1569
+ * Filter the map POI's bubble content.
1570
+ *
1571
+ * @param arrays $tags List of available tags.
1572
+ * @return array Filtered and sorted tags.
1573
+ */
1574
+ function wppb_filter_map_bubble_fields( $tags ) {
1575
+ // Attempt to preseve one tag example.
1576
+ $maybe_avatar = ( ! empty( $tags['avatar_or_gravatar'] ) ) ? $tags['avatar_or_gravatar'] : false;
1577
+
1578
+ // Remove some of the tags.
1579
+ unset( $tags['meta_user_name'] );
1580
+ unset( $tags['more_info_url'] );
1581
+ unset( $tags['avatar_or_gravatar'] );
1582
+
1583
+ if ( ! empty( $maybe_avatar ) ) {
1584
+ // Perhaps preprend this to the list.
1585
+ $tags = array_merge( array( 'avatar_or_gravatar' => $maybe_avatar ), $tags );
1586
+ }
1587
+
1588
+ return $tags;
1589
+ }
1590
+ }
1591
+ add_filter( 'wppb_map_bubble_fields', 'wppb_filter_map_bubble_fields' );
1592
+
assets/css/style-back-end.css CHANGED
@@ -824,4 +824,12 @@ div.wppb-notice .notice-dismiss {
824
 
825
  .profile-builder_page_user-email-customizer #poststuff, .profile-builder_page_admin-email-customizer #poststuff{
826
  padding:0;
827
- }
 
 
 
 
 
 
 
 
824
 
825
  .profile-builder_page_user-email-customizer #poststuff, .profile-builder_page_admin-email-customizer #poststuff{
826
  padding:0;
827
+ }
828
+
829
+ /* Sortable options */
830
+ .wppb_manage_fields_sortables {display: block; border: 1px solid #EEE; margin: 0px 0px 5px 32px; padding: 5px;}
831
+ .wppb_manage_fields_sortables:hover {cursor: pointer; background-color: #EEE;}
832
+ .wppb_manage_fields_sortables label {background: transparent !important;}
833
+ .wppb_manage_fields_sortables > .dashicons {color: #f4f4f4; position: absolute; margin-left: -32px;}
834
+ .wppb_manage_fields_sortables:hover > .dashicons {color: #000;}
835
+ .wppb_selector_for_sortable_checkbox {margin-left: 32px; width: calc(100% - 32px);}
assets/css/style-front-end.css CHANGED
@@ -7,7 +7,7 @@
7
  2.0 - Forms
8
  3.0 - Alignments
9
  4.0 - Errors & Notices
10
- 5.0 - User Listing
11
  6.0 - Media Queries
12
  --------------------------------------------------------------*/
13
 
@@ -739,18 +739,18 @@ ul.wppb-faceted-list .hide-this{
739
  margin-left:0;
740
  }
741
 
742
- .wppb-checkboxes li label,
743
  .wppb-radios li label{
744
  display:inline;
745
  }
746
-
747
  .wppb-form-field .wppb-avatar-nofile,
748
  .wppb-form-field .wppb-avatar-file,
749
  .wppb-form-field .wppb-upload-nofile,
750
  .wppb-form-field .wppb-upload-file{
751
  margin-left:0;
752
  }
753
-
754
  }
755
 
756
  /*--------------------------------------------------------------
@@ -820,3 +820,9 @@ ul.wppb-faceted-list .hide-this{
820
  .wppb-private-website.wppb-private-website-hide-menus .main-navigation{
821
  display:none;
822
  }
 
 
 
 
 
 
7
  2.0 - Forms
8
  3.0 - Alignments
9
  4.0 - Errors & Notices
10
+ 5.0 - User Listing
11
  6.0 - Media Queries
12
  --------------------------------------------------------------*/
13
 
739
  margin-left:0;
740
  }
741
 
742
+ .wppb-checkboxes li label,
743
  .wppb-radios li label{
744
  display:inline;
745
  }
746
+
747
  .wppb-form-field .wppb-avatar-nofile,
748
  .wppb-form-field .wppb-avatar-file,
749
  .wppb-form-field .wppb-upload-nofile,
750
  .wppb-form-field .wppb-upload-file{
751
  margin-left:0;
752
  }
753
+
754
  }
755
 
756
  /*--------------------------------------------------------------
820
  .wppb-private-website.wppb-private-website-hide-menus .main-navigation{
821
  display:none;
822
  }
823
+
824
+
825
+ /* Map markers info */
826
+ .marker-content-info {position: absolute; top: -400px; left: -400px; display: none;}
827
+ .wppb-map-container .marker-content {min-width: 320px; max-width: 100%;}
828
+ .wppb-map-container .marker-content .marker-info-avatar_or_gravatar {float: left; margin-right: 10px;}
assets/js/jquery-manage-fields-live-change.js CHANGED
@@ -509,6 +509,9 @@ var fields = {
509
  '.row-map-default-lng',
510
  '.row-map-default-zoom',
511
  '.row-map-height',
 
 
 
512
  '.row-required'
513
  ]
514
  },
@@ -808,3 +811,84 @@ jQuery(function(){
808
  wppb_enable_select2('#wppb_manage_fields');
809
 
810
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  '.row-map-default-lng',
510
  '.row-map-default-zoom',
511
  '.row-map-height',
512
+ '.row-map-pins-load-type',
513
+ '.row-map-pagination-number',
514
+ '.row-map-bubble-fields',
515
  '.row-required'
516
  ]
517
  },
811
  wppb_enable_select2('#wppb_manage_fields');
812
 
813
  });
814
+
815
+ // Custom functionality for sorting options (see the Map POIs attributes).
816
+ (function ($) {
817
+ window.SortSelCheck = {
818
+ // Initiate the events and triggers.
819
+ init: function () {
820
+ SortSelCheck.assess();
821
+ SortSelCheck.listen();
822
+ },
823
+
824
+ // Listen for events.
825
+ listen: function () {
826
+ // Listen for the new element setup and trigger the expected custom event.
827
+ $('.wck-add-form').on('change', function() {
828
+ SortSelCheck.assess('wck-add-form');
829
+ });
830
+ },
831
+
832
+ // Assess the potential elements and configure these when possible.
833
+ assess: function (elem) {
834
+ var $elem = $('.wppb_sortable_checkboxes_wrap');
835
+ // console.log('assess triggerer ' + elem, $elem);
836
+ $elem.each(function() {
837
+ $rows = SortSelCheck.remake($(this));
838
+ SortSelCheck.attach($(this), $rows);
839
+ });
840
+ },
841
+
842
+ // Configure the elements that form the sortable checkboxes options.
843
+ remake: function ($field) {
844
+ var $rows = $field.children('.wck-checkboxes');
845
+ if (!$rows.length) {
846
+ $field.prepend('<div class="wck-checkboxes"> </div>');
847
+ var $rows = $field.children('.wck-checkboxes');
848
+ }
849
+ if ($rows.length) {
850
+ SortSelCheck.sortable($rows);
851
+ }
852
+ return $rows;
853
+ },
854
+
855
+ // Attach the custom dropdown options as sortable checkboxes options.
856
+ attach: function ($field, $rows) {
857
+ var $ddwn = $field.children('.wppb_selector_for_sortable_checkbox');
858
+ if ($ddwn.length) {
859
+ $ddwn.on('change', function() {
860
+ var val = $(this).val();
861
+ if ('' !== val) {
862
+ $rows.append('<div><label><input type="checkbox" name="' + $(this).data('list') + '" id="' + $(this).data('list') + '_' + val + '" value="' + val + '" checked="checked" class="mb-checkbox mb-field">' + $(this).children('option').filter(':selected').text() + '</label></div>');
863
+ $(this).children('option').filter(':selected').remove();
864
+ SortSelCheck.sortable($rows);
865
+ }
866
+ });
867
+ }
868
+ },
869
+
870
+ // Make sortable items from the list.
871
+ sortable: function ($list) {
872
+ var $items = $list.children('div');
873
+ $items.addClass('wppb_manage_fields_sortables');
874
+ $items.remove('em');
875
+ $items.prepend('<em class="dashicons dashicons-menu"></em> ');
876
+ $list.sortable({
877
+ items: '> div',
878
+ classes: {'ui-sortable': 'highlight'}
879
+ });
880
+ },
881
+
882
+ };
883
+
884
+ $(document).ready(function () {
885
+ // Initialize the custom functionality.
886
+ SortSelCheck.init('init');
887
+
888
+ // Bind the event to the custom functionality.
889
+ $('html').on('wpbFormMetaLoaded', function(e, elem) {
890
+ SortSelCheck.assess(elem);
891
+ });
892
+ });
893
+
894
+ })(jQuery);
assets/lib/wck-api/wordpress-creation-kit.js CHANGED
@@ -1,20 +1,20 @@
1
  /* Add width to elements at startup */
2
  jQuery(function(){
3
- jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
4
  });
5
 
6
  /* Add width to labels if the post box is closed at load */
7
  jQuery(function(){
8
 
9
  /* Callback version */
10
- /* postboxes.pbshow = function(box){
11
- jQuery('strong, .field-label', jQuery('#'+box)).css( 'width', 'auto' );
12
  } */
13
-
14
- jQuery( '.wck-post-box .hndle' ).click( function(){
15
- jQuery('strong, .field-label', jQuery(this).parent() ).css( 'width', 'auto' );
16
  })
17
-
18
  });
19
 
20
 
@@ -30,59 +30,59 @@ function addMeta(value, id, nonce){
30
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
31
  /*object to hold the values */
32
  var values = {};
33
-
34
  jQuery('#'+value+' .mb-field').each(function(){
35
-
36
  var key = jQuery(this).attr('name');
37
-
38
  if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio' ) {
39
-
40
  if( typeof values[key.toString()] === "undefined" )
41
  values[key.toString()] = '';
42
-
43
  if(jQuery(this).is(':checked')){
44
  if( values[key.toString()] == '' )
45
  values[key.toString()] += jQuery(this).val().toString();
46
  else
47
  values[key.toString()] += ', ' + jQuery(this).val().toString();
48
- }
49
  }
50
-
51
- else
52
  values[key.toString()] = jQuery(this).val().toString();
53
  });
54
-
55
  meta = value;
56
-
57
  if( value.indexOf("-wcknested-") != -1 ){
58
  metaDetails = value.split("-wcknested-");
59
  meta = metaDetails[0];
60
  }
61
-
62
  jQuery.post( wppbWckAjaxurl , { action:"wck_add_meta"+meta, meta:value, id:id, values:values, _ajax_nonce:nonce}, function(response) {
63
 
64
  jQuery( '#'+value+' .field-label').removeClass('error');
65
-
66
  if( response.error ){
67
  jQuery('#'+value).parent().css('opacity','1');
68
  jQuery('#mb-ajax-loading').remove();
69
-
70
  jQuery.each( response.errorfields, function (index, field) {
71
  jQuery( '#'+value+' .field-label[for="' + field + '"]' ).addClass('error');
72
- });
73
 
74
  alert( response.error );
75
  }
76
- else{
77
  /* refresh the list */
78
  jQuery('#container_'+value).replaceWith(response.entry_list);
79
-
80
  jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
81
-
82
  if( !jQuery( '#'+value ).hasClass('single') )
83
  mb_sortable_elements();
84
-
85
- /* restore the add form to the original values */
86
  if( !jQuery( '#'+value ).hasClass('single') ){
87
  jQuery( '#'+value ).replaceWith( response.add_form );
88
  jQuery('#'+value).parent().css('opacity','1');
@@ -96,33 +96,33 @@ function addMeta(value, id, nonce){
96
  jQuery('body').trigger('wck-added-element');
97
 
98
  }
99
- });
100
-
101
  }
102
 
103
  /* remove reccord from the meta */
104
  function removeMeta(value, id, element_id, nonce){
105
-
106
  var response = confirm( "Delete this item ?" );
107
-
108
  if( response == true ){
109
-
110
  meta = value;
111
-
112
  if( value.indexOf("-wcknested-") != -1 ){
113
  metaDetails = value.split("-wcknested-");
114
  meta = metaDetails[0];
115
  }
116
-
117
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
118
  jQuery.post( wppbWckAjaxurl , { action:"wck_remove_meta"+meta, meta:value, id:id, element_id:element_id, _ajax_nonce:nonce}, function(response) {
119
-
120
  /* If single add the form */
121
  if( jQuery( '#container_'+value ).hasClass('single') ){
122
  jQuery( '#container_'+value ).before( response.add_form );
123
  jQuery( '#'+value ).addClass('single');
124
  }
125
-
126
  /* refresh the list */
127
  jQuery('#container_'+value).replaceWith(response.entry_list);
128
 
@@ -131,8 +131,8 @@ function removeMeta(value, id, element_id, nonce){
131
  mb_sortable_elements();
132
  jQuery('#'+value).parent().css('opacity','1');
133
  jQuery('#mb-ajax-loading').remove();
134
-
135
- });
136
  }
137
  }
138
 
@@ -140,50 +140,50 @@ function removeMeta(value, id, element_id, nonce){
140
  /*function swapMetaMb(value, id, element_id, swap_with){
141
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
142
  jQuery.post( wppbWckAjaxurl , { action:"swap_meta_mb", meta:value, id:id, element_id:element_id, swap_with:swap_with}, function(response) {
143
-
144
  jQuery.post( wppbWckAjaxurl , { action:"refresh_list", meta:value, id:id}, function(response) {
145
- jQuery('#container_'+value).replaceWith(response); jQuery('#'+value).parent().css('opacity','1'); jQuery('#mb-ajax-loading').remove();
146
  });
147
-
148
- });
149
  }
150
  */
151
 
152
  /* reorder elements through drag and drop */
153
- function mb_sortable_elements() {
154
  jQuery( ".mb-table-container tbody" ).not( jQuery( ".mb-table-container.single tbody, .mb-table-container.not-sortable tbody" ) ).sortable({
155
  placeholder: "wck-state-highlight",
156
  update: function(event, ui){
157
 
158
  var value = jQuery(this).parent().siblings('.wck-add-form').attr('id');
159
  var id = jQuery(this).parent().attr('post');
160
-
161
  var result = jQuery(this).sortable('toArray');
162
-
163
  var values = {};
164
  for(var i in result)
165
  {
166
  values[i] = result[i].replace('element_','');
167
  }
168
-
169
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
170
-
171
  meta = value;
172
-
173
  if( value.indexOf("-wcknested-") != -1 ){
174
  metaDetails = value.split("-wcknested-");
175
  meta = metaDetails[0];
176
  }
177
-
178
-
179
- jQuery.post( wppbWckAjaxurl , { action:"wck_reorder_meta"+meta, meta:value, id:id, values:values}, function(response) {
180
  jQuery('#container_'+value).replaceWith(response.entry_list);
181
-
182
  jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
183
-
184
  mb_sortable_elements();
185
  jQuery('#'+value).parent().css('opacity','1');
186
- jQuery('#mb-ajax-loading').remove();
187
  });
188
  },
189
  items: "> tr"
@@ -192,16 +192,16 @@ function mb_sortable_elements() {
192
  jQuery( "#sortable:not(select)" ).disableSelection();
193
 
194
 
195
- jQuery('.mb-table-container ul').mousedown( function(e){
196
  e.stopPropagation();
197
- });
198
  }
199
  jQuery(mb_sortable_elements);
200
 
201
 
202
 
203
  /* show the update form */
204
- function showUpdateFormMeta(value, id, element_id, nonce){
205
  if( jQuery( '#update_container_' + value + '_' + element_id ).length == 0 ){
206
  jQuery('#container_'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
207
 
@@ -224,6 +224,9 @@ function showUpdateFormMeta(value, id, element_id, nonce){
224
  jQuery('#container_'+value).parent().css('opacity','1');
225
  jQuery('#mb-ajax-loading').remove();
226
  wckGoToByScroll('update_container_' + value + '_' + element_id);
 
 
 
227
  });
228
  }
229
  }
@@ -232,7 +235,7 @@ function showUpdateFormMeta(value, id, element_id, nonce){
232
  function removeUpdateForm( id ){
233
  jQuery('html, body').animate({
234
  scrollTop: jQuery( '#'+id).prev().offset().top - 40 }, 700);
235
-
236
  jQuery( '#'+id).prev().animate({
237
  backgroundColor: '#FFFF9C'
238
  }, 700);
@@ -254,63 +257,63 @@ function updateMeta(value, id, element_id, nonce){
254
  tinyMCE.triggerSave();
255
 
256
  jQuery('#container_'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
257
- var values = {};
258
  jQuery('#update_container_'+value+'_'+element_id+' .mb-field').each(function(){
259
- var key = jQuery(this).attr('name');
260
-
261
  if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio' ) {
262
-
263
  if( typeof values[key.toString()] === "undefined" )
264
  values[key.toString()] = '';
265
-
266
  if(jQuery(this).is(':checked')){
267
  if( values[key.toString()] == '' )
268
  values[key.toString()] += jQuery(this).val().toString();
269
  else
270
  values[key.toString()] += ', ' + jQuery(this).val().toString();
271
- }
272
  }
273
-
274
- else
275
  values[key.toString()] = jQuery(this).val().toString();
276
-
277
  });
278
-
279
-
280
  meta = value;
281
-
282
  if( value.indexOf("-wcknested-") != -1 ){
283
  metaDetails = value.split("-wcknested-");
284
  meta = metaDetails[0];
285
  }
286
-
287
-
288
  jQuery.post( wppbWckAjaxurl , { action:"wck_update_meta"+meta, meta:value, id:id, element_id:element_id, values:values, _ajax_nonce:nonce}, function(response) {
289
 
290
  jQuery( '#update_container_'+value+'_'+element_id + ' .field-label').removeClass('error');
291
-
292
  if( response.error ){
293
  jQuery('#container_'+value).parent().css('opacity','1');
294
  jQuery('#mb-ajax-loading').remove();
295
-
296
  jQuery.each( response.errorfields, function (index, field) {
297
  jQuery( '#update_container_'+value+'_'+element_id + ' .field-label[for="' + field + '"]' ).addClass('error');
298
- });
299
 
300
  alert( response.error );
301
  }
302
  else{
303
-
304
  jQuery('#update_container_'+value+'_'+element_id).remove();
305
-
306
  /* refresh the list */
307
  jQuery('#container_'+value+' #element_'+element_id).replaceWith(response.entry_content);
308
-
309
  jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
310
 
311
  if( jQuery( '#container_' + value + " tbody" ).hasClass('ui-sortable') && jQuery( '#container_' + value + " tbody .wck_update_container" ).length == 0 )
312
  jQuery( '#container_' + value + " tbody" ).sortable("enable");
313
-
314
  jQuery('#container_'+value).parent().css('opacity','1');
315
  jQuery('#mb-ajax-loading').remove();
316
 
@@ -325,15 +328,15 @@ function updateMeta(value, id, element_id, nonce){
325
  backgroundColor: 'none'
326
  }, 1000);
327
  }
328
- });
329
  }
330
 
331
  /* function syncs the translation */
332
  function wckSyncTranslation(id){
333
  jQuery.post( wppbWckAjaxurl , { action:"wck_sync_translation", id:id}, function(response) {
334
  if( response == 'syncsuccess' )
335
- window.location.reload();
336
- });
337
  }
338
 
339
  function wckGoToByScroll(id){
@@ -345,7 +348,7 @@ jQuery(function(){
345
  jQuery(document).on('click', '.wck-remove-upload', function(e){
346
  jQuery(this).parent().parent().parent().children('.mb-field').val("");
347
  jQuery(this).parent().parent('.upload-field-details').html('<p><span class="file-name"></span><span class="file-type"></span></p>');
348
- });
349
  });
350
 
351
  /* Set width for listing "label" equal to the widest */
@@ -382,4 +385,4 @@ function wck_set_to_widest( element, parent ){
382
  jQuery( "#container_" + parent ).append("<style type='text/css'>#container_"+ parent +" strong{display:inline-block;padding-right:5px;width:"+ ( parseInt( widest.width() ) + parseInt( 2 ) ) +"px;}</style>");
383
  }
384
  }
385
- }
1
  /* Add width to elements at startup */
2
  jQuery(function(){
3
+ jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
4
  });
5
 
6
  /* Add width to labels if the post box is closed at load */
7
  jQuery(function(){
8
 
9
  /* Callback version */
10
+ /* postboxes.pbshow = function(box){
11
+ jQuery('strong, .field-label', jQuery('#'+box)).css( 'width', 'auto' );
12
  } */
13
+
14
+ jQuery( '.wck-post-box .hndle' ).click( function(){
15
+ jQuery('strong, .field-label', jQuery(this).parent() ).css( 'width', 'auto' );
16
  })
17
+
18
  });
19
 
20
 
30
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
31
  /*object to hold the values */
32
  var values = {};
33
+
34
  jQuery('#'+value+' .mb-field').each(function(){
35
+
36
  var key = jQuery(this).attr('name');
37
+
38
  if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio' ) {
39
+
40
  if( typeof values[key.toString()] === "undefined" )
41
  values[key.toString()] = '';
42
+
43
  if(jQuery(this).is(':checked')){
44
  if( values[key.toString()] == '' )
45
  values[key.toString()] += jQuery(this).val().toString();
46
  else
47
  values[key.toString()] += ', ' + jQuery(this).val().toString();
48
+ }
49
  }
50
+
51
+ else
52
  values[key.toString()] = jQuery(this).val().toString();
53
  });
54
+
55
  meta = value;
56
+
57
  if( value.indexOf("-wcknested-") != -1 ){
58
  metaDetails = value.split("-wcknested-");
59
  meta = metaDetails[0];
60
  }
61
+
62
  jQuery.post( wppbWckAjaxurl , { action:"wck_add_meta"+meta, meta:value, id:id, values:values, _ajax_nonce:nonce}, function(response) {
63
 
64
  jQuery( '#'+value+' .field-label').removeClass('error');
65
+
66
  if( response.error ){
67
  jQuery('#'+value).parent().css('opacity','1');
68
  jQuery('#mb-ajax-loading').remove();
69
+
70
  jQuery.each( response.errorfields, function (index, field) {
71
  jQuery( '#'+value+' .field-label[for="' + field + '"]' ).addClass('error');
72
+ });
73
 
74
  alert( response.error );
75
  }
76
+ else{
77
  /* refresh the list */
78
  jQuery('#container_'+value).replaceWith(response.entry_list);
79
+
80
  jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
81
+
82
  if( !jQuery( '#'+value ).hasClass('single') )
83
  mb_sortable_elements();
84
+
85
+ /* restore the add form to the original values */
86
  if( !jQuery( '#'+value ).hasClass('single') ){
87
  jQuery( '#'+value ).replaceWith( response.add_form );
88
  jQuery('#'+value).parent().css('opacity','1');
96
  jQuery('body').trigger('wck-added-element');
97
 
98
  }
99
+ });
100
+
101
  }
102
 
103
  /* remove reccord from the meta */
104
  function removeMeta(value, id, element_id, nonce){
105
+
106
  var response = confirm( "Delete this item ?" );
107
+
108
  if( response == true ){
109
+
110
  meta = value;
111
+
112
  if( value.indexOf("-wcknested-") != -1 ){
113
  metaDetails = value.split("-wcknested-");
114
  meta = metaDetails[0];
115
  }
116
+
117
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
118
  jQuery.post( wppbWckAjaxurl , { action:"wck_remove_meta"+meta, meta:value, id:id, element_id:element_id, _ajax_nonce:nonce}, function(response) {
119
+
120
  /* If single add the form */
121
  if( jQuery( '#container_'+value ).hasClass('single') ){
122
  jQuery( '#container_'+value ).before( response.add_form );
123
  jQuery( '#'+value ).addClass('single');
124
  }
125
+
126
  /* refresh the list */
127
  jQuery('#container_'+value).replaceWith(response.entry_list);
128
 
131
  mb_sortable_elements();
132
  jQuery('#'+value).parent().css('opacity','1');
133
  jQuery('#mb-ajax-loading').remove();
134
+
135
+ });
136
  }
137
  }
138
 
140
  /*function swapMetaMb(value, id, element_id, swap_with){
141
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
142
  jQuery.post( wppbWckAjaxurl , { action:"swap_meta_mb", meta:value, id:id, element_id:element_id, swap_with:swap_with}, function(response) {
143
+
144
  jQuery.post( wppbWckAjaxurl , { action:"refresh_list", meta:value, id:id}, function(response) {
145
+ jQuery('#container_'+value).replaceWith(response); jQuery('#'+value).parent().css('opacity','1'); jQuery('#mb-ajax-loading').remove();
146
  });
147
+
148
+ });
149
  }
150
  */
151
 
152
  /* reorder elements through drag and drop */
153
+ function mb_sortable_elements() {
154
  jQuery( ".mb-table-container tbody" ).not( jQuery( ".mb-table-container.single tbody, .mb-table-container.not-sortable tbody" ) ).sortable({
155
  placeholder: "wck-state-highlight",
156
  update: function(event, ui){
157
 
158
  var value = jQuery(this).parent().siblings('.wck-add-form').attr('id');
159
  var id = jQuery(this).parent().attr('post');
160
+
161
  var result = jQuery(this).sortable('toArray');
162
+
163
  var values = {};
164
  for(var i in result)
165
  {
166
  values[i] = result[i].replace('element_','');
167
  }
168
+
169
  jQuery('#'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
170
+
171
  meta = value;
172
+
173
  if( value.indexOf("-wcknested-") != -1 ){
174
  metaDetails = value.split("-wcknested-");
175
  meta = metaDetails[0];
176
  }
177
+
178
+
179
+ jQuery.post( wppbWckAjaxurl , { action:"wck_reorder_meta"+meta, meta:value, id:id, values:values}, function(response) {
180
  jQuery('#container_'+value).replaceWith(response.entry_list);
181
+
182
  jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
183
+
184
  mb_sortable_elements();
185
  jQuery('#'+value).parent().css('opacity','1');
186
+ jQuery('#mb-ajax-loading').remove();
187
  });
188
  },
189
  items: "> tr"
192
  jQuery( "#sortable:not(select)" ).disableSelection();
193
 
194
 
195
+ jQuery('.mb-table-container ul').mousedown( function(e){
196
  e.stopPropagation();
197
+ });
198
  }
199
  jQuery(mb_sortable_elements);
200
 
201
 
202
 
203
  /* show the update form */
204
+ function showUpdateFormMeta(value, id, element_id, nonce){
205
  if( jQuery( '#update_container_' + value + '_' + element_id ).length == 0 ){
206
  jQuery('#container_'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
207
 
224
  jQuery('#container_'+value).parent().css('opacity','1');
225
  jQuery('#mb-ajax-loading').remove();
226
  wckGoToByScroll('update_container_' + value + '_' + element_id);
227
+
228
+ // Allow for extra client-side hooks to be executed.
229
+ jQuery('html').trigger('wpbFormMetaLoaded', meta);
230
  });
231
  }
232
  }
235
  function removeUpdateForm( id ){
236
  jQuery('html, body').animate({
237
  scrollTop: jQuery( '#'+id).prev().offset().top - 40 }, 700);
238
+
239
  jQuery( '#'+id).prev().animate({
240
  backgroundColor: '#FFFF9C'
241
  }, 700);
257
  tinyMCE.triggerSave();
258
 
259
  jQuery('#container_'+value).parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
260
+ var values = {};
261
  jQuery('#update_container_'+value+'_'+element_id+' .mb-field').each(function(){
262
+ var key = jQuery(this).attr('name');
263
+
264
  if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio' ) {
265
+
266
  if( typeof values[key.toString()] === "undefined" )
267
  values[key.toString()] = '';
268
+
269
  if(jQuery(this).is(':checked')){
270
  if( values[key.toString()] == '' )
271
  values[key.toString()] += jQuery(this).val().toString();
272
  else
273
  values[key.toString()] += ', ' + jQuery(this).val().toString();
274
+ }
275
  }
276
+
277
+ else
278
  values[key.toString()] = jQuery(this).val().toString();
279
+
280
  });
281
+
282
+
283
  meta = value;
284
+
285
  if( value.indexOf("-wcknested-") != -1 ){
286
  metaDetails = value.split("-wcknested-");
287
  meta = metaDetails[0];
288
  }
289
+
290
+
291
  jQuery.post( wppbWckAjaxurl , { action:"wck_update_meta"+meta, meta:value, id:id, element_id:element_id, values:values, _ajax_nonce:nonce}, function(response) {
292
 
293
  jQuery( '#update_container_'+value+'_'+element_id + ' .field-label').removeClass('error');
294
+
295
  if( response.error ){
296
  jQuery('#container_'+value).parent().css('opacity','1');
297
  jQuery('#mb-ajax-loading').remove();
298
+
299
  jQuery.each( response.errorfields, function (index, field) {
300
  jQuery( '#update_container_'+value+'_'+element_id + ' .field-label[for="' + field + '"]' ).addClass('error');
301
+ });
302
 
303
  alert( response.error );
304
  }
305
  else{
306
+
307
  jQuery('#update_container_'+value+'_'+element_id).remove();
308
+
309
  /* refresh the list */
310
  jQuery('#container_'+value+' #element_'+element_id).replaceWith(response.entry_content);
311
+
312
  jQuery('.mb-table-container tbody td').css('width', function(){ return jQuery(this).width() });
313
 
314
  if( jQuery( '#container_' + value + " tbody" ).hasClass('ui-sortable') && jQuery( '#container_' + value + " tbody .wck_update_container" ).length == 0 )
315
  jQuery( '#container_' + value + " tbody" ).sortable("enable");
316
+
317
  jQuery('#container_'+value).parent().css('opacity','1');
318
  jQuery('#mb-ajax-loading').remove();
319
 
328
  backgroundColor: 'none'
329
  }, 1000);
330
  }
331
+ });
332
  }
333
 
334
  /* function syncs the translation */
335
  function wckSyncTranslation(id){
336
  jQuery.post( wppbWckAjaxurl , { action:"wck_sync_translation", id:id}, function(response) {
337
  if( response == 'syncsuccess' )
338
+ window.location.reload();
339
+ });
340
  }
341
 
342
  function wckGoToByScroll(id){
348
  jQuery(document).on('click', '.wck-remove-upload', function(e){
349
  jQuery(this).parent().parent().parent().children('.mb-field').val("");
350
  jQuery(this).parent().parent('.upload-field-details').html('<p><span class="file-name"></span><span class="file-type"></span></p>');
351
+ });
352
  });
353
 
354
  /* Set width for listing "label" equal to the widest */
385
  jQuery( "#container_" + parent ).append("<style type='text/css'>#container_"+ parent +" strong{display:inline-block;padding-right:5px;width:"+ ( parseInt( widest.width() ) + parseInt( 2 ) ) +"px;}</style>");
386
  }
387
  }
388
+ }
assets/lib/wck-api/wordpress-creation-kit.php CHANGED
@@ -236,6 +236,9 @@ class Wordpress_Creation_Kit_PB{
236
 
237
  $element .= '<div class="mb-right-column">';
238
 
 
 
 
239
  /*
240
  include actual field type
241
  possible field types: text, textarea, select, checkbox, radio, upload, wysiwyg editor, datepicker, country select, user select, cpt select
@@ -248,6 +251,10 @@ class Wordpress_Creation_Kit_PB{
248
  }
249
  }
250
 
 
 
 
 
251
 
252
  if( file_exists( dirname( __FILE__ ).'/fields/'.$details['type'].'.php' ) ){
253
  require( dirname( __FILE__ ).'/fields/'.$details['type'].'.php' );
@@ -256,6 +263,10 @@ class Wordpress_Creation_Kit_PB{
256
  // Add a filter that allows us to add support for custom field types, not just the ones defined in fields (wck api)
257
  $element .= apply_filters('wck_output_form_field_customtype_' . $details['type'], '', $value, $details, $single_prefix);
258
 
 
 
 
 
259
  if( !empty( $details['description'] ) ){
260
  $element .= '<p class="description">'. $details['description'].'</p>';
261
  }
@@ -1149,7 +1160,7 @@ class Wordpress_Creation_Kit_PB{
1149
  /* only go through for metaboxes defined for this post type */
1150
  if( get_post_type( $post_id ) != $this->args['post_type'] )
1151
  return $post_id;
1152
-
1153
  // Check the user's permissions.
1154
  if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
1155
  if ( ! current_user_can( 'edit_page', $post_id ) ) {
236
 
237
  $element .= '<div class="mb-right-column">';
238
 
239
+ // Allow for appeding custom markup before the element.
240
+ $element .= apply_filters( 'wck_output_form_field_before_customtype_' . $details['type'], '', $value, $details, $single_prefix );
241
+
242
  /*
243
  include actual field type
244
  possible field types: text, textarea, select, checkbox, radio, upload, wysiwyg editor, datepicker, country select, user select, cpt select
251
  }
252
  }
253
 
254
+ if ( isset( $details['options'] ) ) {
255
+ // Allow to filter the options for specific field slugs.
256
+ $details = apply_filters( 'wck_output_form_field_options_by_slug', $details, $details['slug'], $value, $single_prefix );
257
+ }
258
 
259
  if( file_exists( dirname( __FILE__ ).'/fields/'.$details['type'].'.php' ) ){
260
  require( dirname( __FILE__ ).'/fields/'.$details['type'].'.php' );
263
  // Add a filter that allows us to add support for custom field types, not just the ones defined in fields (wck api)
264
  $element .= apply_filters('wck_output_form_field_customtype_' . $details['type'], '', $value, $details, $single_prefix);
265
 
266
+
267
+ // Allow for appeding custom markup after the element.
268
+ $element .= apply_filters( 'wck_output_form_field_after_customtype_' . $details['type'], '', $value, $details, $single_prefix );
269
+
270
  if( !empty( $details['description'] ) ){
271
  $element .= '<p class="description">'. $details['description'].'</p>';
272
  }
1160
  /* only go through for metaboxes defined for this post type */
1161
  if( get_post_type( $post_id ) != $this->args['post_type'] )
1162
  return $post_id;
1163
+
1164
  // Check the user's permissions.
1165
  if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
1166
  if ( ! current_user_can( 'edit_page', $post_id ) ) {
front-end/class-formbuilder.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
  class Profile_Builder_Form_Creator{
3
  private $defaults = array(
4
- 'form_type' => '',
5
  'form_fields' => array(),
6
  'form_name' => '',
7
  'role' => '', //used only for the register-form settings
@@ -11,8 +11,8 @@ class Profile_Builder_Form_Creator{
11
  'ID' => null
12
  );
13
  public $args;
14
-
15
-
16
  // Constructor method for the class
17
  function __construct( $args ) {
18
 
@@ -39,10 +39,10 @@ class Profile_Builder_Form_Creator{
39
 
40
  if( empty( $this->args['form_fields'] ) )
41
  $this->args['form_fields'] = apply_filters( 'wppb_change_form_fields', get_option( 'wppb_manage_fields' ), $this->args );
42
-
43
  if ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/default-fields/default-fields.php' ) )
44
  require_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/default-fields.php' );
45
-
46
  if ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' ) )
47
  require_once( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' );
48
 
@@ -88,7 +88,7 @@ class Profile_Builder_Form_Creator{
88
 
89
  return null;
90
  }
91
-
92
  function wppb_retrieve_custom_settings(){
93
  $this->args['login_after_register'] = apply_filters( 'wppb_automatically_login_after_register', 'No' ); //used only for the register-form settings
94
  $this->args['redirect_activated'] = apply_filters( 'wppb_redirect_default_setting', '-' );
@@ -133,7 +133,7 @@ class Profile_Builder_Form_Creator{
133
 
134
  if ( !is_user_logged_in() ){
135
  if ( !$registration )
136
- echo apply_filters( 'wppb_register_pre_form_message', '<p class="alert" id="wppb_register_pre_form_message">'.__( 'Only an administrator can add new users.', 'profile-builder').'</p>' );
137
 
138
  elseif ( $registration ){
139
  $this->wppb_form_content( apply_filters( 'wppb_register_pre_form_message', '' ) );
@@ -143,10 +143,10 @@ class Profile_Builder_Form_Creator{
143
  $current_user_capability = apply_filters ( 'wppb_registration_user_capability', 'create_users' );
144
 
145
  if ( current_user_can( $current_user_capability ) && $registration )
146
- $this->wppb_form_content( apply_filters( 'wppb_register_pre_form_message', '<p class="alert" id="wppb_register_pre_form_message">'.__( 'Users can register themselves or you can manually create users here.', 'profile-builder'). '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.__( 'This message is only visible by administrators', 'profile-builder' ).'"/>' . '</p>' ) );
147
 
148
  elseif ( current_user_can( $current_user_capability ) && !$registration )
149
- $this->wppb_form_content( apply_filters( 'wppb_register_pre_form_message', '<p class="alert" id="wppb_register_pre_form_message">'.__( 'Users cannot currently register themselves, but you can manually create users here.', 'profile-builder'). '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.__( 'This message is only visible by administrators', 'profile-builder' ).'"/>' . '</p>' ) );
150
 
151
  elseif ( !current_user_can( $current_user_capability ) ){
152
  global $user_ID;
@@ -172,7 +172,7 @@ class Profile_Builder_Form_Creator{
172
 
173
  }elseif ( $this->args['form_type'] == 'edit_profile' ){
174
  if ( !is_user_logged_in() )
175
- echo apply_filters( 'wppb_edit_profile_user_not_logged_in_message', '<p class="warning" id="wppb_edit_profile_user_not_logged_in_message">'.__( 'You must be logged in to edit your profile.', 'profile-builder' ) .'</p>' );
176
 
177
  elseif ( is_user_logged_in() )
178
  $this->wppb_form_content( apply_filters( 'wppb_edit_profile_logged_in_user_message', '' ) );
@@ -258,13 +258,15 @@ class Profile_Builder_Form_Creator{
258
  function wppb_form_content( $message ) {
259
  $field_check_errors = array();
260
 
 
 
261
  if( isset( $_REQUEST['action'] ) && $_REQUEST['form_name'] == $this->args['form_name'] ) {
262
  if( ! isset( $_POST[$this->args['form_type'].'_'. $this->args['form_name'] .'_nonce_field'] ) || ! wp_verify_nonce( $_POST[$this->args['form_type'].'_'. $this->args['form_name'] .'_nonce_field'], 'wppb_verify_form_submission' ) ) {
263
- echo '<span class="wppb-form-error wppb-error">'. __( 'You are not allowed to do this.', 'profile-builder' ) . '</span>';
264
  return;
265
  }
266
 
267
- $field_check_errors = $this->wppb_test_required_form_values( $_REQUEST );
268
  if( empty( $field_check_errors ) ) {
269
 
270
  do_action( 'wppb_before_saving_form_values',$_REQUEST, $this->args );
@@ -349,23 +351,23 @@ class Profile_Builder_Form_Creator{
349
  // CHECK FOR REDIRECT
350
  $redirect = $this->wppb_get_redirect( 'edit_profile', 'after_edit_profile', $account_name, $user_role );
351
 
352
- echo $form_message_tpl_start . apply_filters( 'wppb_edit_profile_success_message', __( 'Your profile has been successfully updated!', 'profile-builder' ) ) . $form_message_tpl_end . $redirect;
353
 
354
  //action hook after edit profile success
355
  do_action( 'wppb_edit_profile_success', $_REQUEST, $this->args['form_name'], $user_id );
356
  if( apply_filters( 'wppb_no_form_after_profile_update', false ) )
357
  return;
358
  }
359
-
360
  }
361
-
362
  }else
363
- echo $message.apply_filters( 'wppb_general_top_error_message', '<p id="wppb_form_general_message" class="wppb-error">'.__( 'There was an error in the submitted form', 'profile-builder' ).'</p>' );
364
-
365
  }else
366
  echo $message;
367
-
368
- // use this action hook to add extra content before the register form
369
  do_action( 'wppb_before_'.$this->args['form_type'].'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );
370
 
371
  $wppb_user_role_class = '';
@@ -381,7 +383,7 @@ class Profile_Builder_Form_Creator{
381
  $wppb_user_role_class = ' wppb-user-logged-out';
382
  }
383
  $wppb_user_role_class = apply_filters( 'wppb_user_role_form_class', $wppb_user_role_class );
384
-
385
  /* set up form id */
386
  $wppb_form_id = '';
387
  if( $this->args['form_type'] == 'register' )
@@ -390,7 +392,7 @@ class Profile_Builder_Form_Creator{
390
  $wppb_form_id = 'wppb-edit-user';
391
  if( isset($this->args['form_name']) && $this->args['form_name'] != "unspecified" )
392
  $wppb_form_id .= '-' . $this->args['form_name'];
393
-
394
  /* set up form class */
395
  $wppb_form_class = 'wppb-user-forms';
396
  if( $this->args['form_type'] == 'register' )
@@ -418,12 +420,12 @@ class Profile_Builder_Form_Creator{
418
  <?php
419
  if( $this->args['form_type'] == 'register' )
420
  $button_name = ( current_user_can( 'create_users' ) ? __( 'Add User', 'profile-builder' ) : __( 'Register', 'profile-builder' ) );
421
-
422
  elseif( $this->args['form_type'] == 'edit_profile' )
423
  $button_name = __( 'Update', 'profile-builder' );
424
  ?>
425
  <?php do_action( 'wppb_form_before_submit_button', $this->args ); ?>
426
- <input name="<?php echo $this->args['form_type']; ?>" type="submit" id="<?php echo $this->args['form_type']; ?>" class="<?php echo apply_filters( 'wppb_'. $this->args['form_type'] .'_submit_class', "submit button" );?>" value="<?php echo apply_filters( 'wppb_'. $this->args['form_type'] .'_button_name', $button_name, $this->args['form_name'] ); ?>" <?php echo apply_filters( 'wppb_form_submit_button_extra_attributes', '', $this->args['form_type'] );?>/>
427
  <?php do_action( 'wppb_form_after_submit_button', $this->args ); ?>
428
  <input name="action" type="hidden" id="action" value="<?php echo $this->args['form_type']; ?>" />
429
  <input name="form_name" type="hidden" id="form_name" value="<?php echo $this->args['form_name']; ?>" />
@@ -447,9 +449,12 @@ class Profile_Builder_Form_Creator{
447
  <?php
448
  // use this action hook to add extra content after the register form
449
  do_action( 'wppb_after_'. $this->args['form_type'] .'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );
450
-
 
 
 
451
  }
452
-
453
  function wppb_output_form_fields( $global_request, $field_check_errors, $form_fields, $called_from = NULL ){
454
  $output_fields = '';
455
 
@@ -477,11 +482,11 @@ class Profile_Builder_Form_Creator{
477
  return apply_filters( 'wppb_output_fields_filter', $output_fields );
478
  }
479
 
480
-
481
  function wppb_add_send_credentials_checkbox ( $request_data, $form ){
482
  if ( $form == 'edit_profile' )
483
  echo '';
484
-
485
  else{
486
  $checkbox = apply_filters( 'wppb_send_credentials_checkbox_logic', '<li class="wppb-form-field wppb-send-credentials-checkbox"><label for="send_credentials_via_email"><input id="send_credentials_via_email" type="checkbox" name="send_credentials_via_email" value="sending"'.( ( isset( $request_data['send_credentials_via_email'] ) && ( $request_data['send_credentials_via_email'] == 'sending' ) ) ? ' checked' : '' ).'/>'.__( 'Send these credentials via email.', 'profile-builder').'</label></li>', $request_data, $form );
487
 
@@ -489,8 +494,8 @@ class Profile_Builder_Form_Creator{
489
  echo ( isset( $wppb_general_settings['emailConfirmation'] ) && ( $wppb_general_settings['emailConfirmation'] == 'yes' ) ? '' : $checkbox );
490
  }
491
  }
492
-
493
-
494
  function wppb_test_required_form_values( $global_request ){
495
  $output_field_errors = array();
496
  $form_fields = apply_filters( 'wppb_form_fields', $this->args['form_fields'], array( 'global_request' => $global_request, 'context' => 'validate_frontend', 'global_request' => $global_request, 'form_type' => $this->args['form_type'], 'role' => $this->args['role'], 'user_id' => $this->wppb_get_desired_user_id() ) );
@@ -505,14 +510,14 @@ class Profile_Builder_Form_Creator{
505
 
506
  return apply_filters( 'wppb_output_field_errors_filter', $output_field_errors, $this->args['form_fields'], $global_request, $this->args['form_type'] );
507
  }
508
-
509
  function wppb_save_form_values( $global_request ){
510
  $user_id = $this->wppb_get_desired_user_id();
511
  $userdata = apply_filters( 'wppb_build_userdata', array(), $global_request, $this->args );
512
  $new_user_signup = false;
513
 
514
  $wppb_general_settings = get_option( 'wppb_general_settings' );
515
-
516
  if( $this->args['form_type'] == 'register' ){
517
 
518
  $result = $this->wppb_register_user( $global_request, $userdata );
@@ -534,7 +539,7 @@ class Profile_Builder_Form_Creator{
534
  if( isset( $userdata['user_pass'] ) && !empty( $userdata['user_pass'] ) ){
535
  unset($userdata['user_pass']);
536
  }
537
-
538
  if( current_user_can( 'manage_options' ) && isset( $userdata['role'] ) && is_array( $userdata['role'] ) ) {
539
  $user_data = get_userdata( $user_id );
540
  $user_data->remove_all_caps();
@@ -548,7 +553,7 @@ class Profile_Builder_Form_Creator{
548
 
549
  wp_update_user( $userdata );
550
  }
551
-
552
  if( !empty( $this->args['form_fields'] ) && !$new_user_signup ){
553
  foreach( $this->args['form_fields'] as $field ){
554
  if( apply_filters( 'wppb_pre_save_form_field', true, $field, $user_id, $global_request, $this->args['form_type'] ) )
1
+ <?php
2
  class Profile_Builder_Form_Creator{
3
  private $defaults = array(
4
+ 'form_type' => '',
5
  'form_fields' => array(),
6
  'form_name' => '',
7
  'role' => '', //used only for the register-form settings
11
  'ID' => null
12
  );
13
  public $args;
14
+
15
+
16
  // Constructor method for the class
17
  function __construct( $args ) {
18
 
39
 
40
  if( empty( $this->args['form_fields'] ) )
41
  $this->args['form_fields'] = apply_filters( 'wppb_change_form_fields', get_option( 'wppb_manage_fields' ), $this->args );
42
+
43
  if ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/default-fields/default-fields.php' ) )
44
  require_once( WPPB_PLUGIN_DIR.'/front-end/default-fields/default-fields.php' );
45
+
46
  if ( file_exists ( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' ) )
47
  require_once( WPPB_PLUGIN_DIR.'/front-end/extra-fields/extra-fields.php' );
48
 
88
 
89
  return null;
90
  }
91
+
92
  function wppb_retrieve_custom_settings(){
93
  $this->args['login_after_register'] = apply_filters( 'wppb_automatically_login_after_register', 'No' ); //used only for the register-form settings
94
  $this->args['redirect_activated'] = apply_filters( 'wppb_redirect_default_setting', '-' );
133
 
134
  if ( !is_user_logged_in() ){
135
  if ( !$registration )
136
+ echo apply_filters( 'wppb_register_pre_form_message', '<p class="alert" id="wppb_register_pre_form_message">'.esc_html(__( 'Only an administrator can add new users.', 'profile-builder')).'</p>' );
137
 
138
  elseif ( $registration ){
139
  $this->wppb_form_content( apply_filters( 'wppb_register_pre_form_message', '' ) );
143
  $current_user_capability = apply_filters ( 'wppb_registration_user_capability', 'create_users' );
144
 
145
  if ( current_user_can( $current_user_capability ) && $registration )
146
+ $this->wppb_form_content( apply_filters( 'wppb_register_pre_form_message', '<p class="alert" id="wppb_register_pre_form_message">'.esc_html(__( 'Users can register themselves or you can manually create users here.', 'profile-builder')). '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.esc_attr(__( 'This message is only visible by administrators', 'profile-builder' )).'"/>' . '</p>' ) );
147
 
148
  elseif ( current_user_can( $current_user_capability ) && !$registration )
149
+ $this->wppb_form_content( apply_filters( 'wppb_register_pre_form_message', '<p class="alert" id="wppb_register_pre_form_message">'.esc_html(__( 'Users cannot currently register themselves, but you can manually create users here.', 'profile-builder')). '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.esc_attr(__( 'This message is only visible by administrators', 'profile-builder' )).'"/>' . '</p>' ) );
150
 
151
  elseif ( !current_user_can( $current_user_capability ) ){
152
  global $user_ID;
172
 
173
  }elseif ( $this->args['form_type'] == 'edit_profile' ){
174
  if ( !is_user_logged_in() )
175
+ echo apply_filters( 'wppb_edit_profile_user_not_logged_in_message', '<p class="warning" id="wppb_edit_profile_user_not_logged_in_message">'.esc_html(__( 'You must be logged in to edit your profile.', 'profile-builder' )) .'</p>' );
176
 
177
  elseif ( is_user_logged_in() )
178
  $this->wppb_form_content( apply_filters( 'wppb_edit_profile_logged_in_user_message', '' ) );
258
  function wppb_form_content( $message ) {
259
  $field_check_errors = array();
260
 
261
+ ob_start();
262
+
263
  if( isset( $_REQUEST['action'] ) && $_REQUEST['form_name'] == $this->args['form_name'] ) {
264
  if( ! isset( $_POST[$this->args['form_type'].'_'. $this->args['form_name'] .'_nonce_field'] ) || ! wp_verify_nonce( $_POST[$this->args['form_type'].'_'. $this->args['form_name'] .'_nonce_field'], 'wppb_verify_form_submission' ) ) {
265
+ echo '<span class="wppb-form-error wppb-error">'. esc_html(__( 'You are not allowed to do this.', 'profile-builder' )) . '</span>';
266
  return;
267
  }
268
 
269
+ $field_check_errors = $this->wppb_test_required_form_values( $_REQUEST );
270
  if( empty( $field_check_errors ) ) {
271
 
272
  do_action( 'wppb_before_saving_form_values',$_REQUEST, $this->args );
351
  // CHECK FOR REDIRECT
352
  $redirect = $this->wppb_get_redirect( 'edit_profile', 'after_edit_profile', $account_name, $user_role );
353
 
354
+ echo $form_message_tpl_start . apply_filters( 'wppb_edit_profile_success_message', esc_html(__( 'Your profile has been successfully updated!', 'profile-builder' )) ) . $form_message_tpl_end . $redirect;
355
 
356
  //action hook after edit profile success
357
  do_action( 'wppb_edit_profile_success', $_REQUEST, $this->args['form_name'], $user_id );
358
  if( apply_filters( 'wppb_no_form_after_profile_update', false ) )
359
  return;
360
  }
361
+
362
  }
363
+
364
  }else
365
+ echo $message.apply_filters( 'wppb_general_top_error_message', '<p id="wppb_form_general_message" class="wppb-error">'.esc_html(__( 'There was an error in the submitted form', 'profile-builder' )).'</p>' );
366
+
367
  }else
368
  echo $message;
369
+
370
+ // use this action hook to add extra content before the register form
371
  do_action( 'wppb_before_'.$this->args['form_type'].'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );
372
 
373
  $wppb_user_role_class = '';
383
  $wppb_user_role_class = ' wppb-user-logged-out';
384
  }
385
  $wppb_user_role_class = apply_filters( 'wppb_user_role_form_class', $wppb_user_role_class );
386
+
387
  /* set up form id */
388
  $wppb_form_id = '';
389
  if( $this->args['form_type'] == 'register' )
392
  $wppb_form_id = 'wppb-edit-user';
393
  if( isset($this->args['form_name']) && $this->args['form_name'] != "unspecified" )
394
  $wppb_form_id .= '-' . $this->args['form_name'];
395
+
396
  /* set up form class */
397
  $wppb_form_class = 'wppb-user-forms';
398
  if( $this->args['form_type'] == 'register' )
420
  <?php
421
  if( $this->args['form_type'] == 'register' )
422
  $button_name = ( current_user_can( 'create_users' ) ? __( 'Add User', 'profile-builder' ) : __( 'Register', 'profile-builder' ) );
423
+
424
  elseif( $this->args['form_type'] == 'edit_profile' )
425
  $button_name = __( 'Update', 'profile-builder' );
426
  ?>
427
  <?php do_action( 'wppb_form_before_submit_button', $this->args ); ?>
428
+ <input name="<?php echo $this->args['form_type']; ?>" type="submit" id="<?php echo $this->args['form_type']; ?>" class="<?php echo apply_filters( 'wppb_'. $this->args['form_type'] .'_submit_class', "submit button" );?>" value="<?php echo apply_filters( 'wppb_'. $this->args['form_type'] .'_button_name', esc_attr( $button_name ), $this->args['form_name'] ); ?>" <?php echo apply_filters( 'wppb_form_submit_button_extra_attributes', '', $this->args['form_type'] );?>/>
429
  <?php do_action( 'wppb_form_after_submit_button', $this->args ); ?>
430
  <input name="action" type="hidden" id="action" value="<?php echo $this->args['form_type']; ?>" />
431
  <input name="form_name" type="hidden" id="form_name" value="<?php echo $this->args['form_name']; ?>" />
449
  <?php
450
  // use this action hook to add extra content after the register form
451
  do_action( 'wppb_after_'. $this->args['form_type'] .'_fields', $this->args['form_name'], $this->args['ID'], $this->args['form_type'] );
452
+
453
+ $form_content = ob_get_clean();
454
+
455
+ echo apply_filters( 'wppb_' . $this->args['form_type'] . '_form_content', $form_content );
456
  }
457
+
458
  function wppb_output_form_fields( $global_request, $field_check_errors, $form_fields, $called_from = NULL ){
459
  $output_fields = '';
460
 
482
  return apply_filters( 'wppb_output_fields_filter', $output_fields );
483
  }
484
 
485
+
486
  function wppb_add_send_credentials_checkbox ( $request_data, $form ){
487
  if ( $form == 'edit_profile' )
488
  echo '';
489
+
490
  else{
491
  $checkbox = apply_filters( 'wppb_send_credentials_checkbox_logic', '<li class="wppb-form-field wppb-send-credentials-checkbox"><label for="send_credentials_via_email"><input id="send_credentials_via_email" type="checkbox" name="send_credentials_via_email" value="sending"'.( ( isset( $request_data['send_credentials_via_email'] ) && ( $request_data['send_credentials_via_email'] == 'sending' ) ) ? ' checked' : '' ).'/>'.__( 'Send these credentials via email.', 'profile-builder').'</label></li>', $request_data, $form );
492
 
494
  echo ( isset( $wppb_general_settings['emailConfirmation'] ) && ( $wppb_general_settings['emailConfirmation'] == 'yes' ) ? '' : $checkbox );
495
  }
496
  }
497
+
498
+
499
  function wppb_test_required_form_values( $global_request ){
500
  $output_field_errors = array();
501
  $form_fields = apply_filters( 'wppb_form_fields', $this->args['form_fields'], array( 'global_request' => $global_request, 'context' => 'validate_frontend', 'global_request' => $global_request, 'form_type' => $this->args['form_type'], 'role' => $this->args['role'], 'user_id' => $this->wppb_get_desired_user_id() ) );
510
 
511
  return apply_filters( 'wppb_output_field_errors_filter', $output_field_errors, $this->args['form_fields'], $global_request, $this->args['form_type'] );
512
  }
513
+
514
  function wppb_save_form_values( $global_request ){
515
  $user_id = $this->wppb_get_desired_user_id();
516
  $userdata = apply_filters( 'wppb_build_userdata', array(), $global_request, $this->args );
517
  $new_user_signup = false;
518
 
519
  $wppb_general_settings = get_option( 'wppb_general_settings' );
520
+
521
  if( $this->args['form_type'] == 'register' ){
522
 
523
  $result = $this->wppb_register_user( $global_request, $userdata );
539
  if( isset( $userdata['user_pass'] ) && !empty( $userdata['user_pass'] ) ){
540
  unset($userdata['user_pass']);
541
  }
542
+
543
  if( current_user_can( 'manage_options' ) && isset( $userdata['role'] ) && is_array( $userdata['role'] ) ) {
544
  $user_data = get_userdata( $user_id );
545
  $user_data->remove_all_caps();
553
 
554
  wp_update_user( $userdata );
555
  }
556
+
557
  if( !empty( $this->args['form_fields'] ) && !$new_user_signup ){
558
  foreach( $this->args['form_fields'] as $field ){
559
  if( apply_filters( 'wppb_pre_save_form_field', true, $field, $user_id, $global_request, $this->args['form_type'] ) )
front-end/default-fields/password/password.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  /* handle field output */
3
  function wppb_password_handler( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){
 
 
4
  $item_title = apply_filters( 'wppb_'.$form_location.'_password_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_title_translation', $field['field-title'] ) );
5
  $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_description_translation', $field['description'] );
6
 
@@ -32,6 +34,7 @@ add_filter( 'wppb_output_form_field_default-password', 'wppb_password_handler',
32
 
33
  /* handle field validation */
34
  function wppb_check_password_value( $message, $field, $request_data, $form_location ){
 
35
  if ( $form_location == 'register' ){
36
  if ( ( isset( $request_data['passw1'] ) && ( trim( $request_data['passw1'] ) == '' ) ) && ( $field['required'] == 'Yes' ) )
37
  return wppb_required_field_error($field["field-title"]);
1
  <?php
2
  /* handle field output */
3
  function wppb_password_handler( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){
4
+
5
+
6
  $item_title = apply_filters( 'wppb_'.$form_location.'_password_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_title_translation', $field['field-title'] ) );
7
  $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_description_translation', $field['description'] );
8
 
34
 
35
  /* handle field validation */
36
  function wppb_check_password_value( $message, $field, $request_data, $form_location ){
37
+
38
  if ( $form_location == 'register' ){
39
  if ( ( isset( $request_data['passw1'] ) && ( trim( $request_data['passw1'] ) == '' ) ) && ( $field['required'] == 'Yes' ) )
40
  return wppb_required_field_error($field["field-title"]);
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 choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
- Version: 2.9.9
7
  Author: Cozmoslabs
8
  Author URI: https://www.cozmoslabs.com/
9
  Text Domain: profile-builder
@@ -75,7 +75,7 @@ function wppb_free_plugin_init() {
75
  *
76
  *
77
  */
78
- define('PROFILE_BUILDER_VERSION', '2.9.9' );
79
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
80
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
81
  define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
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 choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
+ Version: 3.0.0
7
  Author: Cozmoslabs
8
  Author URI: https://www.cozmoslabs.com/
9
  Text Domain: profile-builder
75
  *
76
  *
77
  */
78
+ define('PROFILE_BUILDER_VERSION', '3.0.0' );
79
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
80
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
81
  define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: cozmoslabs, reflectionmedia, sareiodata, adispiac, madalin.ungurea
3
  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, profile
5
  Requires at least: 3.1
6
- Tested up to: 5.1.1
7
- Stable tag: 2.9.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -168,6 +168,10 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
168
  12. Role Editor
169
 
170
  == Changelog ==
 
 
 
 
171
  = 2.9.9 =
172
  * Implemented Elementor Widget/Section restriction.
173
  * Security improvements
3
  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, profile
5
  Requires at least: 3.1
6
+ Tested up to: 5.2.1
7
+ Stable tag: 3.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
168
  12. Role Editor
169
 
170
  == Changelog ==
171
+ = 3.0.0 =
172
+ * Security improvements
173
+ * Added a filter for the Register and Edit Profile forms.
174
+
175
  = 2.9.9 =
176
  * Implemented Elementor Widget/Section restriction.
177
  * Security improvements