PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.9
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.9
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / add-ons-free / gdpr-communication-preferences / admin / manage-fields.php

manage-fields.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.9, at add-ons-free/gdpr-communication-preferences/admin/manage-fields.php

44 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Function that adds the new GDPR Communication Preferences field to the fields list
4 * and also the list of fields that skip the meta-name check
5 *
6 * @param array $fields - The names of all the fields
7 *
8 * @return array
9 *
10 */
11 function wppb_gdprcp_manage_field_types( $fields ) {
12 $fields[] = 'GDPR Communication Preferences';
13 return $fields;
14 }
15 add_filter( 'wppb_manage_fields_types', 'wppb_gdprcp_manage_field_types' );
16
17
18 /* Function adds the GDPR Communication Preferences option to set a maximum selection size
19 *
20 * @param array $fields - The current field properties
21 *
22 */
23 function wppb_gdprcp_manage_fields( $fields ) {
24 $fields[] = array( 'type' => 'checkbox', 'slug' => 'gdpr-communication-preferences', 'title' => __( 'Communication Preferences', 'profile-builder' ), 'options' => array( '%'.__( 'Email', 'profile-builder' ).'%email', '%'.__( 'Telephone', 'profile-builder' ).'%phone', '%'.__( 'SMS', 'profile-builder' ).'%sms', '%'.__( 'Post', 'profile-builder' ).'%post' ), 'description' => __( "Select which communication preferences are available on your site ( drag and drop to re-order )", 'profile-builder' ) );
25 $fields[] = array( 'type' => 'text', 'slug' => 'gdpr-communication-preferences-sort-order', 'title' => __( 'Communication Preferences Order', 'profile-builder' ), 'description' => __( "Save the communication preferences order", 'profile-builder' ) );
26 return $fields;
27 }
28 add_filter( 'wppb_manage_fields', 'wppb_gdprcp_manage_fields' );
29
30
31 /**
32 * Function that calls the wppb_handle_gdprcp_field
33 *
34 * @param void
35 *
36 * @return string
37 */
38 function wppb_gdprcp_sortable_order( $meta_name, $id, $element_id ){
39 if ( $meta_name == 'wppb_manage_fields' ) {
40 echo "<script type=\"text/javascript\">wppb_handle_gdprcp_field( '#container_wppb_manage_fields' );</script>";
41 }
42 }
43 add_action("wck_after_adding_form", "wppb_gdprcp_sortable_order", 10, 3);
44