wip event schedule
This commit is contained in:
@@ -52,6 +52,7 @@ include_once(Plgntls::root_path() . 'php/redirections.php');
|
|||||||
include_once(Plgntls::root_path() . 'php/display_css.php');
|
include_once(Plgntls::root_path() . 'php/display_css.php');
|
||||||
include_once(Plgntls::root_path() . 'php/payments.php');
|
include_once(Plgntls::root_path() . 'php/payments.php');
|
||||||
include_once(Plgntls::root_path() . 'php/random_posts.php');
|
include_once(Plgntls::root_path() . 'php/random_posts.php');
|
||||||
|
include_once(Plgntls::root_path() . 'php/scheduled_events.php');
|
||||||
// admin
|
// admin
|
||||||
include_once(Plgntls::root_path() . 'php/admin_hide_bar.php');
|
include_once(Plgntls::root_path() . 'php/admin_hide_bar.php');
|
||||||
include_once(Plgntls::root_path() . 'php/admin_user_profil.php');
|
include_once(Plgntls::root_path() . 'php/admin_user_profil.php');
|
||||||
|
|||||||
@@ -55,8 +55,10 @@ function prof_profil_check_CIPF() {
|
|||||||
* in case event didn't fire, handle card changes
|
* in case event didn't fire, handle card changes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
handle_transfert_validation_CIPF($user_id);
|
handle_transfert_validation_CIPF($author_id);
|
||||||
handle_card_expire_CIPF($author_id);
|
handle_card_expire_CIPF($author_id);
|
||||||
|
|
||||||
|
schedule_test_CIPF();
|
||||||
}
|
}
|
||||||
add_action('wp', 'prof_profil_check_CIPF', 11);
|
add_action('wp', 'prof_profil_check_CIPF', 11);
|
||||||
|
|
||||||
|
|||||||
@@ -9,26 +9,80 @@ if (!defined('ABSPATH')) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* schedule events :
|
||||||
|
* - first use a function to add the event :
|
||||||
|
* - function launch_schedule_my_evet() {
|
||||||
|
* wp_schedule_single_event($delay, 'hook_event_name');
|
||||||
|
* }
|
||||||
|
* - this will enqueue an action hook when the time will come, that you must define :
|
||||||
|
* - add_action('hook_event_name', 'callback_function');
|
||||||
|
* - and finally, define the function 'callback_function()'
|
||||||
|
*
|
||||||
|
* to define the delay, you can use the strtotime notation
|
||||||
|
* - strtotime('+1 month');
|
||||||
|
* -> https://www.php.net/manual/en/function.strtotime.php
|
||||||
|
* or the time constants in seconds :
|
||||||
|
* - time() + 3 * MINUTE_IN_SECONDS
|
||||||
|
* -> https://codex.wordpress.org/Easier_Expression_of_Time_Constants
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* events :
|
||||||
|
*
|
||||||
|
* - payments : : suppress old order_ids
|
||||||
|
* - profs : email : validation payment prof, send email
|
||||||
|
* - profs : email : validation transfert prof, send email
|
||||||
|
* - partners : : offres temporaires -> gerer qu'elles disparaissent apres la date de validite -> la passer en masquer
|
||||||
|
* - partners : : la gestion des offres à échéance
|
||||||
|
* - payments : email : schedule event pour supprimer le compte xx temps (6 mois ?) apres fin de validite de la carte
|
||||||
|
* - payments : email : schedule event pour supprimer les codes
|
||||||
|
* - payments : email : schedule event pour desactiver la carte
|
||||||
|
* - payments : email : faire rappels emails
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add a schedule event to delete this order_id
|
* add a schedule event to delete this order_id
|
||||||
* after 3 days ?
|
* after 3 days ?
|
||||||
* time() + 60 = one minute from now
|
|
||||||
* time() + MINUTE_IN_SECONDS = one minute from now
|
|
||||||
* -> https://codex.wordpress.org/Easier_Expression_of_Time_Constants
|
|
||||||
* -> also strtotime : https://www.php.net/manual/en/function.strtotime.php
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//function schedule_delete_orderid_CIPF($user_id, $order_id) {
|
function schedule_delete_orderid_CIPF($user_id, $order_id) {
|
||||||
// Plgntls::debug_infos();
|
Plgntls::debug_infos();
|
||||||
// $delay = time() + MINUTE_IN_SECONDS;
|
$delay = strtotime('+3 days');
|
||||||
// wp_schedule_single_event($delay, 'orderid_deletion_event_CIPF', array($user_id, $order_id));
|
wp_schedule_single_event($delay, 'orderid_deletion_event_CIPF', array($user_id, $order_id));
|
||||||
//}
|
}
|
||||||
//function delete_order_id_later_CIPF($user_id, $order_id) {
|
function delete_order_id_later_CIPF($user_id, $order_id) {
|
||||||
// Plgntls::debug_infos();
|
Plgntls::debug_infos();
|
||||||
// delete_user_meta($user_id, 'cipf_order_id', $order_id);
|
delete_user_meta($user_id, 'cipf_order_id', $order_id);
|
||||||
//}
|
}
|
||||||
//add_action('orderid_deletion_event_CIPF', 'delete_order_id_later_CIPF', 5, 2);
|
add_action('orderid_deletion_event_CIPF', 'delete_order_id_later_CIPF', 10, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Submodule wordpress_docker updated: 3c0a32e6ac...ce6d6b442a
Reference in New Issue
Block a user