wip track payment to user

This commit is contained in:
asus
2024-02-25 11:02:47 +01:00
parent 01187a8450
commit 3d9b9bac9e
5 changed files with 171 additions and 147 deletions

View File

@@ -238,22 +238,22 @@ $_POST
"form_id":"modif_profile",
"form_type_confirm":""
}
add_action('parse_request', 'my_custom_url_handler');
function my_custom_url_handler($query)
{
if ($_SERVER['REQUEST_METHOD'] !== 'POST' )
return ;
if ($_SERVER['QUERY_STRING'] !== 'update_profile_acf' )
return ;
// ! add verification that user can do this edit !
foreach($_POST['field_name'] as $field)
{
error_log("_POST[$field]");
error_log($_POST[$field]);
}
}
*/
// add_action('parse_request', 'my_custom_url_handler');
// function my_custom_url_handler($query)
// {
// if ($_SERVER['REQUEST_METHOD'] !== 'POST' )
// return ;
// if ($_SERVER['QUERY_STRING'] !== 'update_profile_acf' )
// return ;
// // ! add verification that user can do this edit !
//
// foreach($_POST['field_name'] as $field)
// {
// error_log("_POST[$field]");
// error_log($_POST[$field]);
// }
// }
/**
@@ -272,63 +272,63 @@ function my_custom_url_handler($query)
* - https://stackoverflow.com/questions/19802492/check-if-current-user-is-administrator-in-wordpress
* - https://developer.wordpress.org/reference/functions/current_user_can/
*/
function PLGNTLS_my_custom_df_form_handler($form_id, $post_array, $form_type)
{
error_log("in my_custom_df_form_handler");
error_log("form_id");
error_log($form_id);
error_log("post_array");
error_log(json_encode($post_array));
error_log("form_type");
error_log($form_type);
}
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)
// {
// error_log("in my_custom_df_form_handler");
// error_log("form_id");
// error_log($form_id);
// error_log("post_array");
// error_log(json_encode($post_array));
// error_log("form_type");
// error_log($form_type);
// }
// add_action ('df_before_process', 'PLGNTLS_my_custom_df_form_handler', 10, 3);
// 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
function handle_acf_form_submission($post_id)
{
error_log("in acf/save_post");
if ($_SERVER['REQUEST_METHOD'] === 'POST' )
{
error_log("_SERVER['REQUEST_URI']");
error_log(json_encode($_SERVER['REQUEST_URI']));
error_log("_SERVER['QUERY_STRING']");
error_log(json_encode($_SERVER['QUERY_STRING']));
error_log("_POST['de_fb_ville']");
error_log(json_encode($_POST['de_fb_ville']));
}
// Check if the request is coming from the specific URL
if ($_SERVER['QUERY_STRING'] !== '/') {
return; // Exit if the request is not from the specific URL
}
// Check if this is an autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// Check if this is a revision
if (wp_is_post_revision($post_id)) {
return;
}
// Check if the current user has permission to edit the post
if (!current_user_can('edit_post', $post_id)) {
return;
}
// Your ACF form submission handling logic goes here
// For example, you can retrieve form data using $_POST and update ACF fields accordingly
if (isset($_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);
}
}
*/
/**
* 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
// function handle_acf_form_submission($post_id)
// {
// error_log("in acf/save_post");
// if ($_SERVER['REQUEST_METHOD'] === 'POST' )
// {
// error_log("_SERVER['REQUEST_URI']");
// error_log(json_encode($_SERVER['REQUEST_URI']));
// error_log("_SERVER['QUERY_STRING']");
// error_log(json_encode($_SERVER['QUERY_STRING']));
// error_log("_POST['de_fb_ville']");
// error_log(json_encode($_POST['de_fb_ville']));
// }
// // Check if the request is coming from the specific URL
// if ($_SERVER['QUERY_STRING'] !== '/') {
// return; // Exit if the request is not from the specific URL
// }
//
// // Check if this is an autosave
// if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
// return;
// }
//
// // Check if this is a revision
// if (wp_is_post_revision($post_id)) {
// return;
// }
//
// // Check if the current user has permission to edit the post
// if (!current_user_can('edit_post', $post_id)) {
// return;
// }
//
// // Your ACF form submission handling logic goes here
// // For example, you can retrieve form data using $_POST and update ACF fields accordingly
// if (isset($_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);
// }
// }