PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
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 4.0.3, at add-ons-free/gdpr-communication-preferences/admin/manage-fields.php

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