109 lines
2.0 KiB
Plaintext
109 lines
2.0 KiB
Plaintext
<?php
|
|
|
|
/*
|
|
* it means someone outside wp is accessing the file, in this case kill it.
|
|
*/
|
|
if (!defined('ABSPATH')) {
|
|
die('You can not access this file!');
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
* custom action in php on custom form submission
|
|
*
|
|
*/
|
|
function admin_validate_prof_CIPF($form_id, $post_array, $form_type) {
|
|
PLGNTLS_class::debug_infos();
|
|
$admin_validate_prof_field = PLGNTLS_class::ADMIN_VALIDATE_PROF_FIELD;
|
|
|
|
if ($form_type !== 'custom')
|
|
return;
|
|
error_log("---");
|
|
// error_log("in test_form_CIPF");
|
|
// error_log("form_id");
|
|
// error_log(json_encode($form_id));
|
|
// error_log("post_array");
|
|
// error_log(json_encode($post_array));
|
|
// error_log("form_type");
|
|
// error_log(json_encode($form_type));
|
|
|
|
$field_id = $post_array['field_id'];
|
|
$contains_id = in_array($admin_validate_prof_field, $field_id);
|
|
if ($contains_id === false)
|
|
return;
|
|
|
|
/* custom action */
|
|
}
|
|
add_action('df_before_process', 'admin_validate_prof_CIPF', 10, 3);
|
|
|
|
|
|
/*
|
|
before :
|
|
|
|
|
|
in test_form_CIPF
|
|
form_id
|
|
""
|
|
post_array
|
|
{"field_title":["\u00c9tat du compte"],"field_name":["de_fb_compte-actif"],"field_id":["de_fb_field_1"],"form_type_confirm":""}
|
|
form_type
|
|
"custom"
|
|
|
|
---
|
|
|
|
after :
|
|
|
|
|
|
in test_form_CIPF
|
|
form_id
|
|
""
|
|
post_array
|
|
{"field_title":["\u00c9tat du compte"],"field_name":["de_fb_compte-actif"],"field_id":["de_fb_field_1"],"form_type_confirm":""}
|
|
form_type
|
|
"custom"
|
|
|
|
---
|
|
|
|
exploded view :
|
|
|
|
{
|
|
"field_title":["\u00c9tat du compte"],
|
|
"field_name":["de_fb_compte-actif"],
|
|
"field_id":["de_fb_field_1"],
|
|
"form_type_confirm":""
|
|
}
|
|
|
|
|
|
{
|
|
"field_title":["\u00c9tat du compte"],
|
|
"field_name":["de_fb_compte-actif"],
|
|
"field_id":["de_fb_field_1"],
|
|
"compte-actif":"Actif",
|
|
"form_type_confirm":""
|
|
}
|
|
CIPF_admin_activation_prof
|
|
{
|
|
"field_title":["\u00c9tat du compte"],
|
|
"field_name":["compte-actif"],
|
|
"field_id":["cipf_admin_activation_prof"],
|
|
"compte-actif":"Inactif",
|
|
"form_type_confirm":""
|
|
}
|
|
|
|
--- with field test :
|
|
|
|
{
|
|
"field_title":["\u00c9tat du compte","test"],
|
|
"field_name":["compte-actif","de_fb_field_3"],
|
|
"field_id":["cipf_admin_activation_prof","de_fb_field_3"],
|
|
"field_3":"",
|
|
"form_type_confirm":""
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
?>
|