- removed jquery validator url patch to put it in another plugin

- starting to try the form_builder hooks for modif acf fields
This commit is contained in:
asus
2024-02-18 13:06:02 +01:00
parent 74fc6e3d1b
commit e9032647f2
3 changed files with 31 additions and 28 deletions

View File

@@ -232,8 +232,6 @@ $_POST
"form_id":"modif_profile", "form_id":"modif_profile",
"form_type_confirm":"" "form_type_confirm":""
} }
*/
add_action('parse_request', 'my_custom_url_handler'); add_action('parse_request', 'my_custom_url_handler');
function my_custom_url_handler($query) function my_custom_url_handler($query)
{ {
@@ -249,31 +247,44 @@ function my_custom_url_handler($query)
error_log($_POST[$field]); error_log($_POST[$field]);
} }
} }
*/
/** /**
* in `wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php` * do_action( 'df_before_process', string $form_id, Array $post_array, String $form_type )
* Undefined variable: min_length in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5933 * Description: Fires after form is submitted and captcha checking is ok.
* Undefined variable: use_icon in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5984 * Parameters:
* - $form_id: (String) Form ID from Form setting.
* - $post_array: (Array) Submitted fields from the form. Keys are mapped field names or custom field names (in case of Field Mapping Type is Custom).
* - $form_type : (String) Form Type
*
* wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php|298 col 18-35| do_action( 'df_before_process', $form_id, $post_array, $form_type );
* wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/ajaxcalls/post_ajax.php|254 col 16-33| do_action( 'df_before_process', $form_id, $post_array, $form_type );
*
* check user rights :
* - https://developer.wordpress.org/reference/functions/is_user_logged_in/
* - https://stackoverflow.com/questions/19802492/check-if-current-user-is-administrator-in-wordpress
* - https://developer.wordpress.org/reference/functions/current_user_can/
*/ */
// function add_my_jquery_patch() add_action ('df_before_process', 'PLGNTLS_my_custom_df_form_handler', 10, 3);
// { function PLGNTLS_my_custom_df_form_handler($form_id, $post_array, $form_type)
// $fipfcard_tools = new PLGNTLS_class(); {
// return $fipfcard_tools->add_to_front error_log("in my_custom_df_form_handler");
// ( error_log("form_id");
// array error_log($form_id);
// ( error_log("post_array");
// 'de_fb_validate' => 'js/jquery_validator_url_patch.js', error_log(json_encode($post_array));
// ) error_log("form_type");
// ); error_log($form_type);
// } }
// add_action('wp_enqueue_scripts', 'add_my_jquery_patch');
// Hook into the 'acf/save_post' action // Hook into the 'acf/save_post' action
/*
add_action('acf/save_post', 'handle_acf_form_submission', 5); // 20 is the priority, you can adjust it as needed add_action('acf/save_post', 'handle_acf_form_submission', 5); // 20 is the priority, you can adjust it as needed
function handle_acf_form_submission($post_id) function handle_acf_form_submission($post_id)
{ {
error_log("in acf/save_post"); error_log("in acf/save_post");
/*
if ($_SERVER['REQUEST_METHOD'] === 'POST' ) if ($_SERVER['REQUEST_METHOD'] === 'POST' )
{ {
error_log("_SERVER['REQUEST_URI']"); error_log("_SERVER['REQUEST_URI']");
@@ -309,8 +320,8 @@ function handle_acf_form_submission($post_id)
$field_value = sanitize_text_field($_POST['your_acf_field_name']); $field_value = sanitize_text_field($_POST['your_acf_field_name']);
update_field('your_acf_field_name', $field_value, $post_id); update_field('your_acf_field_name', $field_value, $post_id);
} }
*/
} }
*/

View File

@@ -1,8 +0,0 @@
// https://stackoverflow.com/questions/12741517/how-to-make-url-validation-without-http-or-add-it-after-validation-passed/44848476#44848476
let old_url = jQuery.validator.methods.url;
jQuery.validator.addMethod( 'url', function(value, element) {
let url = old_url.bind(this);
return url(value, element) || url('http://' + value, element);
}, 'Please enter a valid URL'
);

Submodule private updated: 42644f633f...82bb18ae18