diff --git a/plugins/cipf_plugin/cipf_plugin.php b/plugins/cipf_plugin/cipf_plugin.php index 107e1c8..a217350 100644 --- a/plugins/cipf_plugin/cipf_plugin.php +++ b/plugins/cipf_plugin/cipf_plugin.php @@ -4,7 +4,7 @@ Plugin Name: cipf_plugin Plugin URI: Description: Author: hugogogo -Version: 0.3.13 +Version: 0.4.1 Author URI: */ @@ -46,6 +46,7 @@ include_once(PLGNTLS_class::root_path() . 'php/partners_register.php'); include_once(PLGNTLS_class::root_path() . 'php/partners_page.php'); include_once(PLGNTLS_class::root_path() . 'php/display_css.php'); include_once(PLGNTLS_class::root_path() . 'php/payments.php'); +include_once(PLGNTLS_class::root_path() . 'php/email_registration.php'); diff --git a/plugins/cipf_plugin/php/admin_menu/admin_menu_toggle.php b/plugins/cipf_plugin/php/admin_menu/admin_menu_toggle.php index 4dfda19..cca6be1 100644 --- a/plugins/cipf_plugin/php/admin_menu/admin_menu_toggle.php +++ b/plugins/cipf_plugin/php/admin_menu/admin_menu_toggle.php @@ -63,7 +63,7 @@ add_filter('plugin_action_links_cipf_plugin/cipf_plugin.php', 'add_link_to_custe * */ function toggle_custer_plugin_menu_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_toggle = PLGNTLS_class::SLUG_TOOGLE_ADMIN_MENU; $toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU; @@ -72,6 +72,7 @@ function toggle_custer_plugin_menu_CIPF() { if ($current_slug !== $slug_toggle['_name']) { return; } + PLGNTLS_class::debug_infos(); $show = null; if (!isset($_GET)) { diff --git a/plugins/cipf_plugin/php/display_css.php b/plugins/cipf_plugin/php/display_css.php index b687e82..785975b 100644 --- a/plugins/cipf_plugin/php/display_css.php +++ b/plugins/cipf_plugin/php/display_css.php @@ -12,6 +12,7 @@ if (!defined('ABSPATH')) { function display_page_css_CIPF($user_id = null) { + PLGNTLS_class::debug_infos(); $css_for_states = array(); /* diff --git a/plugins/cipf_plugin/php/email_registration.php b/plugins/cipf_plugin/php/email_registration.php new file mode 100644 index 0000000..2adee84 --- /dev/null +++ b/plugins/cipf_plugin/php/email_registration.php @@ -0,0 +1,45 @@ +\r\n","headers":"","attachments":[]} + +prof login : +-nothing- + +prof reset password : +{"to":"setrujegno@gufum.com","subject":"[La carte internationale des professeurs de fran\u00e7ais] Password Reset","message":"Someone has requested a password reset for the following account:\r\n\r\nSite Name: La carte internationale des professeurs de fran\u00e7ais\r\n\r\nUsername: setrujegno\r\n\r\nIf this was a mistake, just ignore this email and nothing will happen.\r\n\r\nTo reset your password, visit the following address:\r\n\r\nhttps:\/\/local-cipf-plugin.com\/?action=reset_password&key=COiFnR4qJvyaSSky8FZt&login=setrujegno\r\n","headers":"","attachments":[]} + +partenaire register : +{"to":"justatodra@gufum.com","subject":"[La carte internationale des professeurs de fran\u00e7ais] Login Details","message":"Username: justatodra\r\n\r\nTo set your password, visit the following address:\r\n\r\n\r\n","headers":"","attachments":[]} +*/ + + + +function filter_regitration_email_CIPF($wp_new_user_notification_email, $user, $blogname) { + error_log("- wp_new_user_notification_email: ". json_encode($wp_new_user_notification_email)); + error_log("- user: ". json_encode($user)); + error_log("- blogname: ". json_encode($blogname)); + return $wp_new_user_notification_email; +} +add_filter('wp_new_user_notification_email', 'filter_regitration_email_CIPF', 10, 3); +/* +prof register : +- wp_new_user_notification_email: {"to":"derzudospi@gufum.com","subject":"[%s] Login Details","message":"Username: derzudospi\r\n\r\nTo set your password, visit the following address:\r\n\r\nhttps:\/\/local-cipf-plugin.com\/wp-login.php?action=rp&key=NxtYeVuMfdQdcb1t2fD4&login=derzudospi\r\n\r\nhttps:\/\/local-cipf-plugin.com\/wp-login.php\r\n","headers":""} +- user: {"data":{"ID":"221","user_login":"derzudospi","user_pass":"$P$BqmuxKGayo4bNTaGasmrwn46mXP6gv.","user_nicename":"derzudospi","user_email":"derzudospi@gufum.com","user_url":"","user_registered":"2024-03-26 21:32:32","user_activation_key":"","user_status":"0","display_name":"derzudospi"},"ID":221,"caps":{"professeur__professeure":true},"cap_key":"wp_503463_capabilities","roles":["professeur__professeure"],"allcaps":{"unfiltered_html":true,"upload_files":true,"campaign_form_submit":true,"copy_posts":true,"delete_others_posts":true,"delete_posts":true,"delete_private_posts":true,"delete_published_posts":true,"edit_others_posts":true,"edit_posts":true,"edit_private_posts":true,"edit_published_posts":true,"manage_links":true,"publish_posts":true,"read_private_posts":true,"delete_others_pages":true,"delete_pages":true,"delete_private_pages":true,"delete_published_pages":true,"edit_others_pages":true,"edit_pages":true,"edit_private_pages":true,"edit_published_pages":true,"manage_categories":true,"publish_pages":true,"read_private_pages":true,"e2pdf":true,"e2pdf_templates":true,"e2pdf_settings":true,"e2pdf_license":true,"e2pdf_debug":true,"professeur__professeure":true},"filter":null} +- blogname: "La carte internationale des professeurs de fran\u00e7ais" + +*/ + + + +?> diff --git a/plugins/cipf_plugin/php/hide_admin.php b/plugins/cipf_plugin/php/hide_admin.php index 1e5b4e7..74ac0c0 100644 --- a/plugins/cipf_plugin/php/hide_admin.php +++ b/plugins/cipf_plugin/php/hide_admin.php @@ -15,7 +15,7 @@ if (!defined('ABSPATH')) { * hide admin bar if access a front page and is not an admin */ function hide_admin_bar_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $role_admin = PLGNTLS_class::ROLE_ADMIN; $role_fipf = PLGNTLS_class::ROLE_FIPF; @@ -27,6 +27,7 @@ function hide_admin_bar_CIPF() { if (is_admin()) { return; } + PLGNTLS_class::debug_infos(); /* @@ -52,7 +53,7 @@ add_action('after_setup_theme', 'hide_admin_bar_CIPF'); * */ function restrict_admin_access_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $role_admin = PLGNTLS_class::ROLE_ADMIN; $role_fipf = PLGNTLS_class::ROLE_FIPF; @@ -66,6 +67,7 @@ function restrict_admin_access_CIPF() { if (!is_admin()) { return; } + PLGNTLS_class::debug_infos(); /* * some roles are allowed to access the admin panel diff --git a/plugins/cipf_plugin/php/partners_page.php b/plugins/cipf_plugin/php/partners_page.php index d8ef938..104eefb 100644 --- a/plugins/cipf_plugin/php/partners_page.php +++ b/plugins/cipf_plugin/php/partners_page.php @@ -17,7 +17,7 @@ if (!defined('ABSPATH')) { * */ function partner_page_scripts_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $role_partner = PLGNTLS_class::ROLE_PARTNER; /* @@ -33,6 +33,7 @@ function partner_page_scripts_CIPF() { if (!current_user_can($role_partner)) { return; } + PLGNTLS_class::debug_infos(); global $post; $current_post_author = (int)($post->post_author); $current_user_id = (int)get_current_user_id(); diff --git a/plugins/cipf_plugin/php/partners_register.php b/plugins/cipf_plugin/php/partners_register.php index 8fc7a37..fea63a5 100644 --- a/plugins/cipf_plugin/php/partners_register.php +++ b/plugins/cipf_plugin/php/partners_register.php @@ -57,7 +57,7 @@ function add_role_partners_CIPF($customer_data){ * */ if (!isset($_POST[$input_hidden_role])) { - return; + return $customer_data; } if ($_POST[$input_hidden_role] === $role_partner) { $customer_data['role'] = $role_partner; @@ -68,4 +68,5 @@ add_filter('xoo_el_register_new_customer_data', 'add_role_partners_CIPF', 10, 1) + ?> diff --git a/plugins/cipf_plugin/php/paypal/payment_page.php b/plugins/cipf_plugin/php/paypal/payment_page.php index a7c2f71..7911183 100644 --- a/plugins/cipf_plugin/php/paypal/payment_page.php +++ b/plugins/cipf_plugin/php/paypal/payment_page.php @@ -12,19 +12,19 @@ if (!defined('ABSPATH')) { - /* * early checks on payment page * */ function payment_page_checks_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE; // check the slug if (!is_page($slug_paypal_page)) { return; } + PLGNTLS_class::debug_infos(); // get the user id $user_id = get_current_user_id(); @@ -36,12 +36,13 @@ add_action('wp', 'payment_page_checks_CIPF'); + /* * only profs can access this page * */ function payment_page_redirects_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE; $role_prof = PLGNTLS_class::ROLE_PROF; @@ -53,6 +54,7 @@ function payment_page_redirects_CIPF() { if (!is_page($slug_paypal_page)) { return; } + PLGNTLS_class::debug_infos(); /* * if prof, don't redirect @@ -75,13 +77,14 @@ add_action('template_redirect', 'payment_page_redirects_CIPF'); * */ function payment_page_scripts_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_paypal_page = PLGNTLS_class::SLUG_PAYPAL_PAGE; // check the slug if (!is_page($slug_paypal_page)) { return; } + PLGNTLS_class::debug_infos(); // get the user id $user_id = get_current_user_id(); diff --git a/plugins/cipf_plugin/php/profs_form_commande.php b/plugins/cipf_plugin/php/profs_form_commande.php index 513e935..10d99d7 100644 --- a/plugins/cipf_plugin/php/profs_form_commande.php +++ b/plugins/cipf_plugin/php/profs_form_commande.php @@ -71,7 +71,7 @@ add_action('df_after_process', 'prof_after_form_commande_CIPF', 10, 3); * */ function prof_form_restrictions_CIPF(){ - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD; $role_prof = PLGNTLS_class::ROLE_PROF; @@ -82,6 +82,7 @@ function prof_form_restrictions_CIPF(){ if (!is_page($slug_command_card)) { return; } + PLGNTLS_class::debug_infos(); /* * if prof, don't redirect @@ -103,11 +104,12 @@ add_action('template_redirect', 'prof_form_restrictions_CIPF'); * */ function renew_page_filter_message_CIPF(){ - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_command_card = PLGNTLS_class::SLUG_COMMAND_CARD; if (!is_page($slug_command_card)) return; + PLGNTLS_class::debug_infos(); $user_id = get_current_user_id(); diff --git a/plugins/cipf_plugin/php/profs_profil.php b/plugins/cipf_plugin/php/profs_profil.php index 0b2fa7d..0f18745 100644 --- a/plugins/cipf_plugin/php/profs_profil.php +++ b/plugins/cipf_plugin/php/profs_profil.php @@ -41,11 +41,12 @@ add_action('df_after_process', 'prof_after_form_transfert_validation_CIPF', 10, * */ function prof_profil_check_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); // is an author page if (!is_author()) return; + PLGNTLS_class::debug_infos(); // the way to find the id of the author of an author_page $author_id = get_queried_object_id(); @@ -63,7 +64,7 @@ add_action('wp', 'prof_profil_check_CIPF', 11); * */ function prof_profil_redirects_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $role_fipf = PLGNTLS_class::ROLE_FIPF; $role_admin = PLGNTLS_class::ROLE_ADMIN; $role_partner = PLGNTLS_class::ROLE_PARTNER; @@ -75,6 +76,7 @@ function prof_profil_redirects_CIPF() { if (et_fb_is_enabled()) { return; } + PLGNTLS_class::debug_infos(); /* @@ -128,11 +130,12 @@ add_action('template_redirect', 'prof_profil_redirects_CIPF', 11); * */ function prof_profil_scripts_CIPF() { - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); // is an author page if (!is_author()) return; + PLGNTLS_class::debug_infos(); // the way to find the id of the author of an author_page $author_id = get_queried_object_id(); diff --git a/plugins/cipf_plugin/php/profs_states.php b/plugins/cipf_plugin/php/profs_states.php index 9411bb6..39b6d0e 100644 --- a/plugins/cipf_plugin/php/profs_states.php +++ b/plugins/cipf_plugin/php/profs_states.php @@ -44,6 +44,7 @@ if (!defined('ABSPATH')) { function get_field_init_CIPF($acf_field_name, $acf_id) { + PLGNTLS_class::debug_infos(); $acf_state = get_field($acf_field_name, $acf_id); if ($acf_state !== null) { return $acf_state; diff --git a/plugins/cipf_plugin/php/redirections.php b/plugins/cipf_plugin/php/redirections.php index 606390f..9b274c1 100644 --- a/plugins/cipf_plugin/php/redirections.php +++ b/plugins/cipf_plugin/php/redirections.php @@ -121,7 +121,7 @@ function redirection_profil_CIPF(){ * */ function redirection_page_CIPF(){ - PLGNTLS_class::debug_infos(); + PLGNTLS_class::debug_infos(2); $slug_page_redirection = PLGNTLS_class::SLUG_PAGE_REDIRECTION; @@ -138,6 +138,7 @@ function redirection_page_CIPF(){ if ($current_slug !== $slug_page_redirection) { return; } + PLGNTLS_class::debug_infos(); redirection_profil_CIPF(); } diff --git a/plugins/cipf_plugin/utils/plgntls_class.php b/plugins/cipf_plugin/utils/plgntls_class.php index 6bd7a05..b6f38c5 100644 --- a/plugins/cipf_plugin/utils/plgntls_class.php +++ b/plugins/cipf_plugin/utils/plgntls_class.php @@ -107,8 +107,8 @@ class PLGNTLS_class { //const PAYPAL_CLIENT_ID = self::PAYPAL_HUGO_LIVE_CLIENT_ID; //const PAYPAL_CLIENT_SECRET = self::PAYPAL_HUGO_LIVE_CLIENT_SECRET; //const PAYPAL_API_BASE_URL = self::PAYPAL_HUGO_LIVE_API_BASE_URL; - const PAYPAL_MESSAGE_SUCCESS = '`paiement reussi`'; - const PAYPAL_MESSAGE_FAILURE = '`paiement raté`'; + const PAYPAL_MESSAGE_SUCCESS = '`Paiement reussi, vous allez être redirigé-es vers votre espace`'; + const PAYPAL_MESSAGE_FAILURE = '`Paiement raté, vous allez être redirigé-es vers votre espace`'; // ROLES const ROLE_PROF = 'professeur__professeure'; @@ -147,7 +147,15 @@ class PLGNTLS_class { const INPUT_HIDDEN_ROLE = 'cipf_user_role'; - private static $_DEBUG_INFOS = false; + /* + * 0 : dont output + * 1 : output only level 1 - not always on top of function, output default, only prevent if specifically level 2 + * typical for early hooks like 'init' or 'wp', where there is a first check to see if you should 'enter' in this function, level 1 will be present after thoses checks + * 2 : output everything + * + */ + private static $_DEBUG_INFOS = 0; + private static $_plugin_dir_path; private static $_plugin_name; private static $_file_dir_path; @@ -235,9 +243,13 @@ class PLGNTLS_class { * for debug purposes * */ - public static function debug_infos() { - if (self::$_DEBUG_INFOS === false) + public static function debug_infos($level = null) { + if (self::$_DEBUG_INFOS === 0) { return; + } + else if (self::$_DEBUG_INFOS === 1 && $level === 2) { + return; + } $trace = debug_backtrace(); $function = $trace[1]['function']; $file = $trace[0]['file']; diff --git a/plugins/fbpatch/fbpatch.php b/plugins/fbpatch/fbpatch.php index d78ee5c..0d86b45 100644 --- a/plugins/fbpatch/fbpatch.php +++ b/plugins/fbpatch/fbpatch.php @@ -4,7 +4,7 @@ Plugin Name: fbpatch_plugin Plugin URI: Description: some patchs for the form_builder plugin's bugs Author: hugogogo -Version: 0.1.3 +Version: 0.1.3.1 Author URI: */ diff --git a/plugins/fbpatch/php/patches/hide_show.php b/plugins/fbpatch/php/patches/hide_show.php index 435f46b..a9328bc 100644 --- a/plugins/fbpatch/php/patches/hide_show.php +++ b/plugins/fbpatch/php/patches/hide_show.php @@ -109,7 +109,7 @@ function after_form_inserted($form_id, $post_id, $post_array) { //error_log("post_array: " . json_encode($post_array)); Fbpatch::end_skip_hook(); } -add_action('df_after_insert_post', ''); +add_action('df_after_insert_post', __NAMESPACE__.'\after_form_inserted', 10, 3); @@ -118,4 +118,3 @@ add_action('df_after_insert_post', ''); ?> -