diff --git a/:b debu b/:b debu deleted file mode 100644 index 2616d18..0000000 --- a/:b debu +++ /dev/null @@ -1,286 +0,0 @@ - $success, - 'failure' => $failure, - 'problem' => $problem, - ); - Plgntls::update_option_safe($option_name, $data); -} - - - - - - -function update_paypal_credentials_CIPF($request, $option_name, $option_data, $option_default) { - Plgntls::debug_infos(); - - if (!isset( - $request['sandbox_or_live'], - $request['live_client_id'], - $request['live_client_secret'], - $request['sandbox_client_id'], - $request['sandbox_client_secret'], - )) { - return; - } - - /* - * force price 1 cent ? - * - */ - $force_1_cent = false; - if (isset($request['force_1_cent'])) { - $force_1_cent = true; - } - - /* - * is sandbox or live ? - * - */ - $is_sandbox = false; - if ($request['sandbox_or_live'] === 'sandbox') { - $is_sandbox = true; - } - else if ($request['sandbox_or_live'] === 'live') { - $is_sandbox = false; - } - - - /* - * ids - * - */ - $live_client_id = $request['live_client_id']; - $live_client_secret = $request['live_client_secret']; - $sandbox_client_id = $request['sandbox_client_id']; - $sandbox_client_secret = $request['sandbox_client_secret']; - - - /* - * update the option with new credentials - * - set_paypal_options_CIPF($is_sandbox, $client_id, $client_secret); - */ - $data = array( - 'force_1_cent' => $force_1_cent, - 'is_sandbox' => $is_sandbox, - 'live_client_id' => $live_client_id, - 'live_client_secret' => $live_client_secret, - 'sandbox_client_id' => $sandbox_client_id, - 'sandbox_client_secret' => $sandbox_client_secret, - ); - Plgntls::update_option_safe($option_name, $data); -} - - - - - - -/* -* update emails -* -*/ -function update_emails_settings_option_CIPF($request, $option_name, $option_data, $option_default) { - Plgntls::debug_infos(); - - /* - * loop through saved data option - * update them - * add them to the option that will be saved - * - */ - foreach ($option_data as $email_type => $email_options) { -error_log("1:"); - $ret_update = update_email_by_type_CIPF($email_type, $email_options, $option_default[$email_type], $request); - if ($ret_update !== false) { - $option_data[$email_type] = $ret_update; - } - } - - /* - * to reorder and add new data with the default data - * also take the name of the default - * - */ - $new_option = array(); - foreach ($option_default as $email => $options) { - if (isset($option_data[$email])) { - $new_option[$email] = $option_data[$email]; - } - else { - // it means it was not in the saved data, but was added in the default -error_log("2:"); - $ret_update = update_email_by_type_CIPF($email, $options, $option_default[$email], $request); - if ($ret_update !== false) { - $new_option[$email] = $ret_update; - } - else { - $new_option[$email] = $options; - } - } - $new_option[$email]['name'] = $options['name']; - } - - Plgntls::update_option_safe($option_name, $new_option); -} - - - -/* -* utility function to update the emails -* -*/ -function update_email_by_type_CIPF($email_type, $email_options, $email_default_options, $request) { - Plgntls::debug_infos(); - $is_new = false; - -if($email_type === 'cron_job')error_log("---"); -if($email_type === 'cron_job')error_log("email_type: " . json_encode($email_type)); - /* - * set notification/confirmation_send to false by default, - * because the request only contains the value 'on' if checked, nothing for false - * - */ - $email_options['notification_send'] = false; - $email_options['confirmation_send'] = false; - - /* - * loop through all options to update them - * - */ - //$tmp_type = 'cron_job'; - $tmp_type = 'payment_success'; - $tmp_option = 'notification_send'; - if($email_type === $tmp_type)error_log("request : " . json_encode($request)); - foreach ($email_default_options as $default_option => $default_value) { - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("default_option: " . json_encode($default_option) . " -> default_value : " . json_encode($default_value)); - $request_name = $email_type.'_'.$default_option; - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("isset? : " . $request_name); - if (!isset($request[$request_name])) { - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("!isset"); - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("- email_options: " . json_encode($email_options)); - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("- default_option: " . json_encode($default_option)); - if (isset($email_options[$default_option])) { - continue; - } - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("--!isset"); - $is_new = true; - $email_options[$default_option] = $default_value; - continue; - } - $new_value = $request[$request_name]; - $value = $email_options[$default_option]; - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("new_value: " . json_encode($new_value)); - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("value : " . json_encode($value)); - if ($new_value === $value) { - continue; - } - $is_new = true; - if ($default_option === 'notification_send' || $default_option === 'confirmation_send') { - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("is notification_send"); - $email_options[$default_option] = true; - } - else { - if($email_type === $tmp_type && $default_option === $tmp_option)error_log("is not notification_send"); - $email_options[$default_option] = $new_value; - } - } - - if ($is_new === false) { - return false; - } - else { - return $email_options; - } -} - - - - - -?> diff --git a/plugins/cipf_plugin/css/acf_fields.css b/plugins/cipf_plugin/css/acf_fields.css index 679d53d..7fe9a52 100644 --- a/plugins/cipf_plugin/css/acf_fields.css +++ b/plugins/cipf_plugin/css/acf_fields.css @@ -1,3 +1,4 @@ +/* .read_only_cipf { .acf-input { position: relative; @@ -15,3 +16,4 @@ } } } +*/ diff --git a/plugins/cipf_plugin/php/_utils_acf_disabled.php b/plugins/cipf_plugin/php/_utils_acf_disabled.php index 077d8b5..87bbd8c 100644 --- a/plugins/cipf_plugin/php/_utils_acf_disabled.php +++ b/plugins/cipf_plugin/php/_utils_acf_disabled.php @@ -8,6 +8,87 @@ if (!defined('ABSPATH')) { } +/* + +{"ID":43757,"key":"field_6617daff359b2","label":"rappels emails","name":"rappels_emails","aria-label":"","prefix":"acf", "type":"checkbox", "value":null,"menu_order":0,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"hide_group_for_fipfrole_cipf read_only_cipf","id":""},"choices":{"card_expiration \/ -30 days":"PROF EXPIRATION - rappel email 1 mois avant expiration de la carte","card_expiration \/ -7 days":"PROF EXPIRATION - rappel email 7 jours avant expiration de la carte","card_expired":"PROF EXPIRATION - email quand la carte a expir\u00e9","account_deletion \/ -30 days":"PROF SUPPRESSION - rappel email 1 mois avant suppression du compte","account_deletion \/ -7 days":"PROF SUPPRESSION - rappel email 7 jours avant suppression du compte","offer_expiration_1 \/ -7 days":"PARTENAIRE EXPIRATION 1 - rappel email 7 jours avant expiration d'une offre","offer_expiration_2 \/ -7 days":"PARTENAIRE EXPIRATION 2 - rappel email 7 jours avant expiration d'une offre","offer_expiration_3 \/ -7 days":"PARTENAIRE EXPIRATION 3 - rappel email 7 jours avant expiration d'une offre"},"default_value":[],"return_format":"label","allow_custom":0,"layout":"vertical","toggle":0,"save_custom":0,"custom_choice_button_text":"Add new choice","_name":"rappels_emails","_valid":1} +{"ID":43880,"key":"field_66200b6283912","label":"text_readonly","name":"text_readonly","aria-label":"","prefix":"acf", "type":"text", "value":null,"menu_order":1,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","maxlength":"","placeholder":"","prepend":"","append":"","_name":"text_readonly","_valid":1} +{"ID":43881,"key":"field_66200c4383914","label":"textarea_readonly","name":"textarea_readonly","aria-label":"","prefix":"acf","type":"textarea", "value":null,"menu_order":2,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","maxlength":"","rows":"","placeholder":"","new_lines":"","_name":"textarea_readonly","_valid":1} +{"ID":43882,"key":"field_66200b7f83913","label":"number_readonly","name":"number_readonly","aria-label":"","prefix":"acf", "type":"number", "value":null,"menu_order":3,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","min":"","max":"","placeholder":"","step":"","prepend":"","append":"","_name":"number_readonly","_valid":1} +{"ID":43883,"key":"field_66200d7583916","label":"range_readonly","name":"range_readonly","aria-label":"","prefix":"acf", "type":"range", "value":null,"menu_order":4,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","min":"","max":"","step":"","prepend":"","append":"","_name":"range_readonly","_valid":1} +{"ID":43884,"key":"field_66200da983917","label":"email_readonly","name":"email_readonly","aria-label":"","prefix":"acf", "type":"email", "value":null,"menu_order":5,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","placeholder":"","prepend":"","append":"","_name":"email_readonly","_valid":1} +{"ID":43885,"key":"field_66200dbd83918","label":"url_readonly","name":"url_readonly","aria-label":"","prefix":"acf", "type":"url", "value":null,"menu_order":6,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","placeholder":"","_name":"url_readonly","_valid":1} +{"ID":43886,"key":"field_66200dfb83919","label":"password_readonly","name":"password_readonly","aria-label":"","prefix":"acf","type":"password", "value":null,"menu_order":7,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"placeholder":"","prepend":"","append":"","_name":"password_readonly","_valid":1} +{"ID":43887,"key":"field_66200e0d8391a","label":"image_readonly","name":"image_readonly","aria-label":"","prefix":"acf", "type":"image", "value":null,"menu_order":8,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"return_format":"array","library":"all","min_width":"","min_height":"","min_size":"","max_width":"","max_height":"","max_size":"","mime_types":"","preview_size":"medium","_name":"image_readonly","_valid":1} +{"ID":43888,"key":"field_66201a805f90d","label":"file","name":"file","aria-label":"","prefix":"acf", "type":"file", "value":null,"menu_order":9,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"return_format":"array","library":"all","min_size":"","max_size":"","mime_types":"","_name":"file","_valid":1} +{"ID":43889,"key":"field_66201a955f90e","label":"wysiwyg","name":"wysiwyg","aria-label":"","prefix":"acf", "type":"wysiwyg", "value":null,"menu_order":10,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","tabs":"all","toolbar":"full","media_upload":1,"delay":0,"_name":"wysiwyg","_valid":1} +{"ID":43890,"key":"field_66201aa45f90f","label":"oembed","name":"oembed","aria-label":"","prefix":"acf", "type":"oembed", "value":null,"menu_order":11,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"width":"","height":"","_name":"oembed","_valid":1} +{"ID":43891,"key":"field_66201aad5f910","label":"select","name":"select","aria-label":"","prefix":"acf", "type":"select", "value":null,"menu_order":12,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"choices":{"one":"one","two":"two"},"default_value":false,"return_format":"value","multiple":0,"allow_null":0,"ui":0,"ajax":0,"placeholder":"","_name":"select","_valid":1} +{"ID":43892,"key":"field_66201ac05f911","label":"checkbox","name":"checkbox","aria-label":"","prefix":"acf", "type":"checkbox", "value":null,"menu_order":13,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"choices":{"one":"one","two":"two"},"default_value":[],"return_format":"value","allow_custom":0,"layout":"vertical","toggle":0,"save_custom":0,"custom_choice_button_text":"Add new choice","_name":"checkbox","_valid":1} +{"ID":43893,"key":"field_66201ad25f912","label":"radio","name":"radio","aria-label":"","prefix":"acf", "type":"radio", "value":null,"menu_order":14,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"choices":{"one":"one","two":"two"},"default_value":"","return_format":"value","allow_null":0,"other_choice":0,"layout":"vertical","save_other_choice":0,"_name":"radio","_valid":1} +{"ID":43894,"key":"field_66201adb5f913","label":"button group","name":"button_group","aria-label":"","prefix":"acf", "type":"button_group","value":null,"menu_order":15,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"choices":{"one":"one","two":"two"},"default_value":"","return_format":"value","allow_null":0,"layout":"horizontal","_name":"button_group","_valid":1} +{"ID":43895,"key":"field_66201ae95f914","label":"true-false","name":"true-false","aria-label":"","prefix":"acf", "type":"true_false", "value":null,"menu_order":16,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"message":"message","default_value":0,"ui":0,"ui_on_text":"","ui_off_text":"","_name":"true-false","_valid":1} +{"ID":43896,"key":"field_66201af35f915","label":"link","name":"link","aria-label":"","prefix":"acf", "type":"link", "value":null,"menu_order":17,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"return_format":"array","_name":"link","_valid":1} +{"ID":43897,"key":"field_66201b015f916","label":"post object","name":"post_object","aria-label":"","prefix":"acf", "type":"post_object", "value":null,"menu_order":18,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"post_type":"","post_status":"","taxonomy":"","return_format":"object","multiple":0,"allow_null":0,"bidirectional":0,"ui":1,"bidirectional_target":[],"_name":"post_object","_valid":1} +{"ID":43898,"key":"field_66201b0c5f917","label":"page link","name":"page_link","aria-label":"","prefix":"acf", "type":"page_link", "value":null,"menu_order":19,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"post_type":"","post_status":"","taxonomy":"","allow_archives":1,"multiple":0,"allow_null":0,"_name":"page_link","_valid":1} +{"ID":43899,"key":"field_66201b1a5f918","label":"relationship","name":"relationship","aria-label":"","prefix":"acf", "type":"relationship","value":null,"menu_order":20,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"post_type":"","post_status":"","taxonomy":"","filters":["search","post_type","taxonomy"],"return_format":"object","min":"","max":"","elements":"","bidirectional":0,"bidirectional_target":[],"_name":"relationship","_valid":1} +{"ID":43900,"key":"field_66201b275f919","label":"taxonomy","name":"taxonomy","aria-label":"","prefix":"acf", "type":"taxonomy", "value":null,"menu_order":21,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"taxonomy":"category","add_term":1,"save_terms":0,"load_terms":0,"return_format":"id","field_type":"checkbox","bidirectional":0,"multiple":0,"allow_null":0,"bidirectional_target":[],"_name":"taxonomy","_valid":1} +{"ID":43901,"key":"field_66201b335f91a","label":"user","name":"user","aria-label":"","prefix":"acf", "type":"user", "value":null,"menu_order":22,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"role":"","return_format":"array","multiple":0,"allow_null":0,"bidirectional":0,"bidirectional_target":[],"_name":"user","_valid":1} +{"ID":43902,"key":"field_66201b3f5f91b","label":"gmap","name":"gmap","aria-label":"","prefix":"acf", "type":"google_map", "value":null,"menu_order":23,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"center_lat":-37,"center_lng":144,"zoom":"","height":"","_name":"gmap","_valid":1} +{"ID":43903,"key":"field_66201b4c5f91c","label":"date picker","name":"date_picker","aria-label":"","prefix":"acf", "type":"date_picker", "value":null,"menu_order":24,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"display_format":"d\/m\/Y","return_format":"d\/m\/Y","first_day":1,"_name":"date_picker","_valid":1} +{"ID":43904,"key":"field_66201b565f91d","label":"ate time picker","name":"ate_time_picker","aria-label":"","prefix":"acf", "type":"date_picker", "value":null,"menu_order":25,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"display_format":"d\/m\/Y","return_format":"d\/m\/Y","first_day":1,"_name":"ate_time_picker","_valid":1} +{"ID":43905,"key":"field_66201b5e5f91e","label":"time picker","name":"time_picker","aria-label":"","prefix":"acf", "type":"time_picker", "value":null,"menu_order":26,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"display_format":"g:i a","return_format":"g:i a","_name":"time_picker","_valid":1} +{"ID":43906,"key":"field_66201b685f91f","label":"color picker","name":"color_picker","aria-label":"","prefix":"acf", "type":"color_picker","value":null,"menu_order":27,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"default_value":"","enable_opacity":0,"return_format":"string","_name":"color_picker","_valid":1} +{"ID":43907,"key":"field_66201b745f920","label":"message","name":"","aria-label":"","prefix":"acf", "type":"message", "value":false,"menu_order":28,"instructions":"","required":0,"id":"","class":"","conditional_logic":0,"parent":43775,"wrapper":{"width":"","class":"read_only_cipf","id":""},"message":"message","new_lines":"wpautop","esc_html":0,"_name":"","_valid":1} + + + + +-> $field['disabled'] = 1; + +27. [/] text class-acf-field-text.php* : +28. [/] textarea class-acf-field-textarea.php* : +14. [/] number class-acf-field-number.php* : + 7. [/] email class-acf-field-email.php* : +31. [/] url class-acf-field-url.php* : +18. [x] password (text) class-acf-field-password.php* : + 5. [/] date_picker class-acf-field-date_picker.php* : + 6. [/] date_picker class-acf-field-date_time_picker.php* : +29. [/] time_picker class-acf-field-time_picker.php* : +23. [/] select class-acf-field-select.php* : + +-> has the option + + 3. [/] checkbox class-acf-field-checkbox.php* : +20. [/] radio class-acf-field-radio.php* : + +-> has elements + +21. [/] range class-acf-field-range.php* : + 2. [x] button_group class-acf-field-button-group.php* : + 4. [x] color_picker class-acf-field-color_picker.php* : +17. [x] page_link class-acf-field-page_link.php* : +19. [x] post_object class-acf-field-post_object.php* : +26. [x] taxonomy class-acf-field-taxonomy.php* : +30. [x] true_false class-acf-field-true_false.php* : +32. [x] user class-acf-field-user.php* : +33. [x] wysiwyg class-acf-field-wysiwyg.php* : + +-> no need + +13. [x] message class-acf-field-message.php* : / + 1. [x] class-acf-field-accordion.php* : / +25. [x] class-acf-field-tab.php* : / +10. [x] class-acf-field-group.php* : / + + 8. [x] file class-acf-field-file.php* : / + 9. [x] google_map class-acf-field-google-map.php* : / +11. [x] image class-acf-field-image.php* : / +12. [x] link class-acf-field-link.php* : / +15. [x] oembed class-acf-field-oembed.php* : / +22. [x] relationship class-acf-field-relationship.php* : / + +*/ + /* @@ -34,8 +115,12 @@ function is_acf_field_disabled($field) { /* -* if acf field has class to be disabled -* -> add the 'disabled' value to object after it is loaded +* if acf field has class to be disabled, +* -> add a disabled value to object after it is loaded +* -> the way to do it depends on the field type +* -> for the fields that dont have a default mechanisme : +* - add 'client_side_disabled' +* - then use other filters to complete the work : 'acf/field_wrapper_attributes' and 'acf/pre_update_value' * */ function disable_acf_field_CIPF($field) { @@ -45,8 +130,37 @@ function disable_acf_field_CIPF($field) { return $field; } - $field['disabled'] = 1; - //$field['readonly'] = 1; + + $type = $field['type']; + if (in_array($type, array( + 'text', + 'textarea', + 'number', + 'email', + 'url', + 'password', + 'date_picker', + 'time_picker', + 'select', + ))) { + $field['disabled'] = 1; + } + else if (in_array($type, array( + 'checkbox', + 'radio', + ))) { + if (!isset($field['choices'])) { + return $field; + } + $choices = $field['choices']; + $to_disable = array_keys($choices); + // acf cast the strings (line 128 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-radio.php) + $to_disable = array_map(function($e){return (string)$e;}, $to_disable); + $field['disabled'] = $to_disable; + } + else { + $field['client_side_disabled'] = 1; + } return $field; } @@ -54,8 +168,36 @@ add_filter('acf/load_field', 'disable_acf_field_CIPF'); + + +/* +* filter the wrapper of the acf field +* if it has the property 'client_side_disabled', +* -> add inert attribute : it will prevent any action from front, +* -> but it will not prevent from being saved with form +* -> see filter 'acf/pre_update_value' for that +* 737 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/advanced-custom-fields/includes/acf-field-functions.php +* +*/ +function change_acf_field_wrapper_CIPF($wrapper, $field) { + Plgntls::debug_infos(); + + if (!isset($field['client_side_disabled'])) { + return $wrapper; + } + + error_log("+field: " . json_encode($field)); + $wrapper["inert"] = "true"; + return $wrapper; +} +add_filter('acf/field_wrapper_attributes', 'change_acf_field_wrapper_CIPF', 10, 2); + + + + /* * if acf field has class to be disabled +* -> and _POST[acf] is set : it means it comes from front * -> dont update the values * -> should work for all acf fields * 200 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/advanced-custom-fields/includes/acf-value-functions.php @@ -64,17 +206,21 @@ add_filter('acf/load_field', 'disable_acf_field_CIPF'); function disable_all_acf_field_CIPF($null, $value, $post_id, $field) { Plgntls::debug_infos(); - if (!isset($_POST['acf'])) { - return $null; - } - if (!is_acf_field_disabled($field)) { - return $null; + if (isset($field['client_side_disabled'])) { + return false; } - return false; + return $null; } add_filter('acf/pre_update_value', 'disable_all_acf_field_CIPF', 10, 4); + + + + + + + ?>