wip creating emails

This commit is contained in:
asus
2024-04-02 17:01:25 +02:00
parent 1f5fff26d6
commit 47360119e8
4 changed files with 62 additions and 16 deletions

View File

@@ -28,12 +28,6 @@ include_once( plugin_dir_path(__FILE__) . '/plgntls_class.php');
include_once(Plgntls::root_path() . 'php/utils/globals.php');
include_once(Plgntls::root_path() . 'php/utils/console_log.php');
include_once(Plgntls::root_path() . 'php/admin_menu/admin_menu.php');
include_once(Plgntls::root_path() . 'php/admin_menu/admin_menu_toggle.php');
include_once(Plgntls::root_path() . 'php/admin_menu/menu_content.php');
include_once(Plgntls::root_path() . 'php/admin_menu/post_paypal.php');
include_once(Plgntls::root_path() . 'php/admin_menu/post_payment_messages.php');
// paypal
include_once(Plgntls::root_path() . 'php/paypal/paypal.php');
// profs
@@ -53,6 +47,7 @@ include_once(Plgntls::root_path() . 'php/display_css.php');
include_once(Plgntls::root_path() . 'php/payments.php');
include_once(Plgntls::root_path() . 'php/random_posts.php');
include_once(Plgntls::root_path() . 'php/scheduled_events.php');
include_once(Plgntls::root_path() . 'php/emails.php');
// admin
include_once(Plgntls::root_path() . 'php/admin_hide_bar.php');
include_once(Plgntls::root_path() . 'php/admin_user_profil.php');
@@ -154,6 +149,22 @@ vous allez être redirigés vers votre espace',
vous allez être redirigés vers votre espace',
],
];
const OPTION_EMAILS = [
'_name'=>'cipf_emails_option',
'_callback'=>'update_emails_settings_option_CIPF',
'_default'=>[
[
'action'=>'success_payment',
'notification_send'=>true,
'notification_to'=>'test',
'notification_subject'=>"paiement réussi",
'notification_message'=>"par ici la monnaie",
'confirmation_send'=>true,
'confirmation_subject'=>"paiement réussi",
'confirmation_mesage'=>"donne l'argent",
],
],
];
// ADMIN MENU

View File

@@ -0,0 +1,34 @@
<?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!');
}
function email_success_payment_CIPF($user_id) {
Plgntls::debug_infos();
$user = get_user_by('id', $user_id);
$to = $user->user_email;
$subject = 'My Custom Email Subject';
$message = 'Hello, This is a test email sent from my WordPress plugin!';
$headers = array('Content-Type: text/html; charset=UTF-8');
$sent = wp_mail($to, $subject, $message, $headers);
// Check if the email was sent successfully
if (!$sent) {
error_log('Email sending failed!');
}
}
?>

View File

@@ -171,6 +171,7 @@ function success_payment_for_user_CIPF($user_id, $order_id) {
set_payment_success_CIPF($user_id);
set_account_valid_CIPF($user_id);
email_success_payment_CIPF($user_id);
}

View File

@@ -31,17 +31,17 @@ if (!defined('ABSPATH')) {
*/
/*
* events :
* events and emails :
*
* - 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
* - payments : action : : suppress old order_ids
* - profs : : email : validation payment prof, send email
* - profs : : email : validation transfert prof, send email
* - partners : action : : offres temporaires -> gerer qu'elles disparaissent apres la date de validite -> la passer en masquer
* - partners : action : : la gestion des offres à échéance
* - payments : action : email : schedule event pour supprimer le compte xx temps (6 mois ?) apres fin de validite de la carte
* - payments : action : email : schedule event pour supprimer les codes
* - payments : action : email : schedule event pour desactiver la carte
* - payments : action : email : faire rappels emails
*
*
*