- tests on editing author page with acf fields
- some reflexions on registrations
This commit is contained in:
1
plugins/fipfcard_plugin/css/partenaires/partenaires.css
Normal file
1
plugins/fipfcard_plugin/css/partenaires/partenaires.css
Normal file
@@ -0,0 +1 @@
|
||||
div {}
|
||||
@@ -8,24 +8,25 @@ Version: 1.1.0
|
||||
Author URI:
|
||||
*/
|
||||
|
||||
/**
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
/*
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* plugin dir root
|
||||
*/
|
||||
/*
|
||||
* plugin dir root
|
||||
*/
|
||||
include_once( plugin_dir_path(__FILE__) . '/utils/plgntls_class.php');
|
||||
PLGNTLS_class::set_root_dir( plugin_dir_path(__FILE__), plugin_dir_url(__FILE__) );
|
||||
|
||||
/**
|
||||
* general inclusions
|
||||
*/
|
||||
|
||||
/*
|
||||
* general inclusions
|
||||
*/
|
||||
include_once(PLGNTLS_class::get_path() . '/php/utils/globals.php');
|
||||
include_once(PLGNTLS_class::get_path() . '/php/utils/console_log.php');
|
||||
|
||||
@@ -34,20 +35,22 @@ include_once(PLGNTLS_class::get_path() . '/php/utils/console_log.php');
|
||||
|
||||
//include_once(PLGNTLS_class::get_path() . '/php/test_cache.php');
|
||||
|
||||
include_once(PLGNTLS_class::get_path() . '/php/paypal/paypal.php');
|
||||
|
||||
include_once(PLGNTLS_class::get_path() . '/php/partenaires/partenaires.php');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* test the class PLGNTLS
|
||||
*/
|
||||
/*
|
||||
* test the class PLGNTLS
|
||||
*/
|
||||
add_shortcode('fipfcard_plugin', 'fipfcard_test_class_tools');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
function custom_frontend_posting_form() {
|
||||
$my_image = the_field('image_ratio');
|
||||
error_log("my_image");
|
||||
@@ -55,236 +58,28 @@ function custom_frontend_posting_form() {
|
||||
return $my_image;
|
||||
}
|
||||
add_shortcode('custom_frontend_posting_form', 'custom_frontend_posting_form');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* call to paypal_shortcode_content()
|
||||
*/
|
||||
include_once(PLGNTLS_class::get_path() . '/php/paypal/paypal.php');
|
||||
add_shortcode('fipf_paypal_shortcode', 'fipf_paypal_shortcode_content');
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
function PLGNTLS_conditional_print_offers() {
|
||||
error_log("---");
|
||||
error_log("inside PLGNTLS_print_offers_conditionnal");
|
||||
}
|
||||
add_action('et_after_main_content', 'PLGNTLS_conditional_print_offers');
|
||||
*/
|
||||
//add_action('et_head_meta', 'PLGNTLS_conditional_print_offers');
|
||||
//add_action('et_before_main_content', 'PLGNTLS_conditional_print_offers');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* do_action( 'df_before_process', string $form_id, Array $post_array, String $form_type )
|
||||
* Description: Fires after form is submitted and captcha checking is ok.
|
||||
* 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 PLGNTLS_df_before_process_handler($form_id, $post_array, $form_type)
|
||||
{
|
||||
error_log("---");
|
||||
error_log("in PLGNTLS_df_before_process_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_df_before_process_handler', 10, 3 );
|
||||
function PLGNTLS_df_after_insert_post_handler($form_id, $post_id, $post_array)
|
||||
{
|
||||
error_log("---");
|
||||
error_log("in PLGNTLS_df_after_insert_post_handler");
|
||||
error_log("form_id");
|
||||
error_log($form_id);
|
||||
error_log("post_id");
|
||||
error_log($post_id);
|
||||
error_log("post_array");
|
||||
error_log(json_encode($post_array));
|
||||
}
|
||||
add_action( 'df_after_insert_post', 'PLGNTLS_df_after_insert_post_handler', 10, 3 );
|
||||
*/
|
||||
/*
|
||||
in my_custom_df_form_handler
|
||||
|
||||
form_id
|
||||
crea_partenaire
|
||||
|
||||
post_array
|
||||
{
|
||||
"post_status":"publish",
|
||||
"field_title":
|
||||
[
|
||||
"Nom commercial",
|
||||
"Votre site Internet",
|
||||
"Dans quelle rubrique devez-vous para\u00eetre ? ",
|
||||
"L\\'accroche en t\u00eate de page",
|
||||
"Pr\u00e9sentez-vous",
|
||||
"Votre logo ",
|
||||
"Image principale",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous ajouter une offre ?",
|
||||
"Voulez-vous afficher cette offre ?",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)",
|
||||
"Voulez-vous ajouter une offre ?",
|
||||
"Voulez-vous afficher l\\'offre ?",
|
||||
"Titre",
|
||||
"Texte de l\\'offre",
|
||||
"Image (facultatif)"
|
||||
],
|
||||
"post_title":"test",
|
||||
"meta_input":
|
||||
[
|
||||
"de_fb_url_partenaire",
|
||||
"de_fb_logo_partenaire",
|
||||
"de_fb_offre_1_titre",
|
||||
"de_fb_offre_1_txt",
|
||||
"de_fb_offre_1_image",
|
||||
"de_fb_ajouter_offre_2",
|
||||
"de_fb_afficher_offre_2",
|
||||
"de_fb_offre_2_titre",
|
||||
"de_fb_offre_2_txt",
|
||||
"de_fb_offre_2_image",
|
||||
"de_fb_ajouter_offre_3",
|
||||
"de_fb_afficher_offre_3",
|
||||
"de_fb_offre_3_titre",
|
||||
"de_fb_offre_3_txt",
|
||||
"de_fb_offre_3_image"
|
||||
],
|
||||
"url_partenaire":"",
|
||||
"tax_input":["de_fb_project_category"],
|
||||
"project_category":"hebergement",
|
||||
"post_excerpt":"test",
|
||||
"post_content":"test",
|
||||
"_ajax_linking_nonce":"0e855ae1a9",
|
||||
"logo_partenaire":"38157",
|
||||
"post_thumbnail":"38156",
|
||||
"offre_1_titre":"test",
|
||||
"offre_1_txt":"test",
|
||||
"offre_1_image":"",
|
||||
"ajouter_offre_2":"Oui",
|
||||
"afficher_offre_2":"Masquer",
|
||||
"offre_2_titre":"test",
|
||||
"offre_2_txt":"test",
|
||||
"offre_2_image":"",
|
||||
"ajouter_offre_3":"Non",
|
||||
"offre_3_image":"",
|
||||
"ID":"38158",
|
||||
"form_type_confirm":""
|
||||
}
|
||||
|
||||
form_type
|
||||
project
|
||||
|
||||
|
||||
|
||||
-------------
|
||||
|
||||
in PLGNTLS_df_after_insert_post_handler
|
||||
|
||||
form_id
|
||||
crea_partenaire
|
||||
|
||||
post_id
|
||||
38158
|
||||
|
||||
post_array
|
||||
{
|
||||
"post_status":"publish",
|
||||
"field_title":
|
||||
[
|
||||
1. "Nom commercial",
|
||||
2. "Votre site Internet",
|
||||
3. "Dans quelle rubrique devez-vous para\u00eetre ? ",
|
||||
4. "L\\'accroche en t\u00eate de page",
|
||||
5. "Pr\u00e9sentez-vous",
|
||||
6. "Votre logo ",
|
||||
7. "Image principale",
|
||||
8. "Titre",
|
||||
9. "Texte de l\\'offre",
|
||||
10. "Image (facultatif)",
|
||||
11. "Voulez-vous ajouter une offre ?",
|
||||
12. "Voulez-vous afficher cette offre ?",
|
||||
13. "Titre","Texte de l\\'offre",
|
||||
14. "Image (facultatif)",
|
||||
15. "Voulez-vous ajouter une offre ?",
|
||||
16. "Voulez-vous afficher l\\'offre ?",
|
||||
17. "Titre",
|
||||
18. "Texte de l\\'offre",
|
||||
19. "Image (facultatif)"
|
||||
],
|
||||
"post_title":"test",
|
||||
"meta_input":
|
||||
{
|
||||
1. "url_partenaire":"",
|
||||
2. "_url_partenaire":"field_65cb83096d020",
|
||||
3. "logo_partenaire":"38157",
|
||||
4. "_logo_partenaire":"field_65cb79150ac4f",
|
||||
5. "offre_1_titre":"test",
|
||||
6. "_offre_1_titre":"field_65d8bbf6b4651",
|
||||
7. "offre_1_txt":"test",
|
||||
8. "_offre_1_txt":"field_65d8bc395bf88",
|
||||
9. "offre_1_image":"",
|
||||
10. "_offre_1_image":"field_65d8bc5d5bf8b",
|
||||
11. "ajouter_offre_2":"Oui",
|
||||
12. "_ajouter_offre_2":"field_65d8c834e1ac9",
|
||||
13. "afficher_offre_2":"Masquer",
|
||||
14. "_afficher_offre_2":"field_65d8cf09395a5",
|
||||
15. "offre_2_titre":"test",
|
||||
16. "_offre_2_titre":"field_65d8bc201740b",
|
||||
17. "offre_2_txt":"test",
|
||||
18. "_offre_2_txt":"field_65d8bc4c5bf89",
|
||||
19. "offre_2_image":"",
|
||||
20. "_offre_2_image":"field_65d8bc6e5bf8c",
|
||||
21. "ajouter_offre_3":"Non",
|
||||
22. "_ajouter_offre_3":"field_65d8c880fb783",
|
||||
23. "afficher_offre_3":[],
|
||||
24. "offre_3_titre":[],
|
||||
25. "offre_3_txt":[],
|
||||
26. "offre_3_image":"",
|
||||
27. "_offre_3_image":"field_65d8bc8c5bf8e"
|
||||
},
|
||||
"tax_input":{"project_category":[39]},
|
||||
"post_excerpt":"test",
|
||||
"post_content":"test",
|
||||
"_ajax_linking_nonce":"0e855ae1a9",
|
||||
"post_thumbnail":"38156",
|
||||
"ID":"38158",
|
||||
"form_type_confirm":"",
|
||||
"post_type":"project",
|
||||
"post_date":"2024-02-28 18:57:20"
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
menu plugin
|
||||
* menu plugin
|
||||
*/
|
||||
include_once(PLGNTLS_class::get_path() . '/php/menu/example_menu.php');
|
||||
function fipfcard_plugin_menu()
|
||||
|
||||
2
plugins/fipfcard_plugin/js/partenaires/switch_offers.js
Normal file
2
plugins/fipfcard_plugin/js/partenaires/switch_offers.js
Normal file
@@ -0,0 +1,2 @@
|
||||
console.log("PLGNTLS_data.output :");
|
||||
console.log(PLGNTLS_data.output);
|
||||
69
plugins/fipfcard_plugin/php/partenaires/partenaires.php
Normal file
69
plugins/fipfcard_plugin/php/partenaires/partenaires.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
|
||||
/*
|
||||
* the wp_footer hook fire on the front end just before the closing body tag
|
||||
* this function depends on the names of acf fields :
|
||||
* - afficher_offre_*
|
||||
* - -> Masquer / *
|
||||
* - offre_x* (image, titre, txt)
|
||||
function my_custom_js_function_PLGNTLS() {
|
||||
if (!is_singular("project"))
|
||||
return ;
|
||||
error_log("------");
|
||||
|
||||
// list all acf fields of the current post
|
||||
$acf_group_fields = get_fields();
|
||||
// list offers to mask
|
||||
$offers_to_mask = array_filter($acf_group_fields, function($value, $key){
|
||||
if (!str_starts_with($key, "afficher_offre_"))
|
||||
return false;
|
||||
if ($value === "Masquer")
|
||||
return true;
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
foreach($offers_to_mask as $key => $value){
|
||||
$needle = str_replace( "afficher_", "",$key);
|
||||
}
|
||||
error_log("needle");
|
||||
error_log($needle);
|
||||
$to_mask = array_filter($acf_group_fields, function($value, $key){
|
||||
if (str_starts_with($key, $needle))
|
||||
return true;
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
// select only the acf fields "afficher_offre_*"
|
||||
// $acf_offers = array_filter($acf_group_fields, function($field){
|
||||
// $field_name = $field['name'];
|
||||
// return str_starts_with($field_name, "afficher_offre_");
|
||||
// });
|
||||
// list of "afficher_offre_" for current post that are on "Masquer"
|
||||
// error_log("---");
|
||||
// $to_mask = array();
|
||||
// foreach($acf_offers as $offer){
|
||||
// $key = $offer['key'];
|
||||
// error_log("key:");
|
||||
// error_log($key);
|
||||
// $field_value = get_field($key);
|
||||
// error_log("field_value:");
|
||||
// error_log($field_value);
|
||||
// if ($field_value === 'Masquer') {
|
||||
// $to_mask[] = $offer;
|
||||
// }
|
||||
// }
|
||||
|
||||
$output = $to_mask;
|
||||
$fipfcard_project = new PLGNTLS_class();
|
||||
return $fipfcard_project->add_to_front(
|
||||
array(
|
||||
"css/partenaires/partenaires.css",
|
||||
"js/partenaires/switch_offers.js",
|
||||
),
|
||||
compact(
|
||||
"output",
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action('wp_footer', 'my_custom_js_function_PLGNTLS');
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
@@ -38,6 +38,10 @@ add_action('template_redirect', 'check_paypal_request');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* call to paypal_shortcode_content()
|
||||
*/
|
||||
function fipf_paypal_shortcode_content()
|
||||
{
|
||||
$fipfcard_paypal = new PLGNTLS_class();
|
||||
@@ -67,6 +71,9 @@ function fipf_paypal_shortcode_content()
|
||||
|
||||
return $added_to_front;
|
||||
}
|
||||
add_shortcode('fipf_paypal_shortcode', 'fipf_paypal_shortcode_content');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -100,5 +107,4 @@ function fipf_routes_endpoints()
|
||||
add_action('rest_api_init', 'fipf_routes_endpoints');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -296,7 +296,7 @@ class PLGNTLS_class
|
||||
if ($already_enqueued !== false)
|
||||
return null;
|
||||
}
|
||||
else if ($script->ext === "css")
|
||||
else if ($src->ext === "css")
|
||||
{
|
||||
global $wp_styles;
|
||||
$already_enqueued = array_search($src->handle, $wp_styles->queue);
|
||||
|
||||
2
private
2
private
Submodule private updated: 7bb12740a9...5252a3d6c2
Reference in New Issue
Block a user