wip emails front admin menu
This commit is contained in:
@@ -161,6 +161,7 @@ contactez la fipf directement",
|
||||
'_default'=>[
|
||||
// 1. profs : email : payment_success : validation payment prof reussi, send email
|
||||
'payment_success'=>[
|
||||
'name'=>'le paiement a réussi',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"paiement réussi",
|
||||
@@ -171,6 +172,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 2. profs : email : payment_failure : validation payment prof echec, send email
|
||||
'payment_echec'=>[
|
||||
'name'=>'le paiement a echoué',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -181,6 +183,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 3. profs : email : transfert_success : validation transfert prof reussi, send email
|
||||
'transfert_success'=>[
|
||||
'name'=>'le virement a été validé',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -191,6 +194,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 4. profs : email : transfert_failures : validation transfert prof echec, send email
|
||||
'transfert_echec'=>[
|
||||
'name'=>'le virement a échoué',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -201,6 +205,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 5. partners : email : offer_expired : offres temporaires -> gerer qu'elles disparaissent apres la date de validite -> la passer en masquer
|
||||
'offer_expired'=>[
|
||||
'name'=>"l'offre a expirée",
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -211,6 +216,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 6. partners : email : offer_will_expire : la gestion des offres à échéance
|
||||
'offer_will_expire'=>[
|
||||
'name'=>"l'offre arrive bientot a expiration",
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -221,6 +227,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 7. payments : email : account_deleted : schedule event pour supprimer le compte xx temps (6 mois ?) apres fin de validite de la carte
|
||||
'account_deleted'=>[
|
||||
'name'=>'le compte a ete supprimé',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -230,7 +237,8 @@ contactez la fipf directement",
|
||||
'confirmation_message'=>"",
|
||||
],
|
||||
// 8. payments : email : account_will_expire : faire rappels emails avant expiration
|
||||
'eccount_will_expire'=>[
|
||||
'account_will_expire'=>[
|
||||
'name'=>'le compte va bientot expirer',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
@@ -241,6 +249,7 @@ contactez la fipf directement",
|
||||
],
|
||||
// 9. payments : email : account_expired : desactiver carte expiree
|
||||
'account_expired'=>[
|
||||
'name'=>'le compte a expiré',
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"",
|
||||
|
||||
@@ -75,3 +75,40 @@
|
||||
<input type="submit" value="send"/>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
'payment_success'=>[
|
||||
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"paiement réussi",
|
||||
'notification_message'=>"par ici la monnaie",
|
||||
|
||||
'confirmation_send'=>true,
|
||||
'confirmation_subject'=>"paiement réussi",
|
||||
'confirmation_message'=>"donne l'argent",
|
||||
-->
|
||||
<h1>emails :</h1>
|
||||
<?php echo Plgntls::open_form_option($option_emails_name); ?>
|
||||
|
||||
<?php foreach($option_emails as $name => $email_options) { ?>
|
||||
<div class="set_email_options_cipf vertical_wrapper">
|
||||
|
||||
<h2><?php echo esc_html($name); ?> :</h2>
|
||||
<div>
|
||||
<input type="checkbox" id="<?php echo esc_html($name); ?>_notification" name="<?php echo esc_html($name); ?>_notification_send" <?php if ($email_options['notification_send'] === true) {echo 'checked';} ?> />
|
||||
<label for="<?php echo esc_html($name); ?>_notification">envoyer une notification ?</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" id="<?php echo esc_html($name); ?>_confirmation" name="<?php echo esc_html($name); ?>_confirmation_send" <?php if ($email_options['confirmation_send'] === true) {echo 'checked';} ?> />
|
||||
<label for="<?php echo esc_html($name); ?>_confirmation">envoyer une confirmation ?</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<input type="submit" value="send"/>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ function add_plugin_content_CIPF() {
|
||||
Plgntls::debug_infos();
|
||||
$option_paypal_object = Cipf::OPTION_PAYPAL;
|
||||
$option_payment_object = Cipf::OPTION_PAYMENT;
|
||||
$option_emails_object = Cipf::OPTION_EMAILS;
|
||||
|
||||
/*
|
||||
* options
|
||||
@@ -38,6 +39,8 @@ function add_plugin_content_CIPF() {
|
||||
$option_paypal = Plgntls::get_option_safe($option_paypal_object);
|
||||
$option_payment_name = $option_payment_object['_name'];
|
||||
$option_payment = Plgntls::get_option_safe($option_payment_object);
|
||||
$option_emails_name = $option_emails_object['_name'];
|
||||
$option_emails = Plgntls::get_option_safe($option_emails_object);
|
||||
|
||||
ob_start();
|
||||
include(Plgntls::root_path() . '/html/menu/cipf_menu.html');
|
||||
@@ -157,5 +160,90 @@ function update_paypal_credentials_CIPF($request, $option_name, $option_data, $o
|
||||
|
||||
|
||||
|
||||
function update_emails_settings_option_CIPF($request, $option_name, $option_data, $option_default) {
|
||||
Plgntls::debug_infos();
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
error_log("request: " . json_encode($request));
|
||||
error_log("option_data: " . json_encode($option_data));
|
||||
foreach ($option_data as $email => $email_options) {
|
||||
error_log("email: " . $email);
|
||||
error_log("email_options: " . json_encode($email_options));
|
||||
if (isset($request[$email])) {
|
||||
error_log("email is set");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// $is_sandbox = false;
|
||||
// if (!isset($request['sandbox_or_live'])) {
|
||||
// return;
|
||||
// }
|
||||
// if ($request['sandbox_or_live'] === 'sandbox') {
|
||||
// $is_sandbox = true;
|
||||
// }
|
||||
// else if ($request['sandbox_or_live'] === 'live') {
|
||||
// $is_sandbox = false;
|
||||
// }
|
||||
// else {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*
|
||||
// * client id
|
||||
// *
|
||||
// */
|
||||
// $client_id = '';
|
||||
// if (!isset($request['client_id'])) {
|
||||
// return;
|
||||
// }
|
||||
// else {
|
||||
// $client_id = $request['client_id'];
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*
|
||||
// * client secret
|
||||
// *
|
||||
// */
|
||||
// $client_secret = '';
|
||||
// if (!isset($request['client_secret'])) {
|
||||
// return;
|
||||
// }
|
||||
// else {
|
||||
// $client_secret = $request['client_secret'];
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*
|
||||
// * update the option with new credentials
|
||||
// *
|
||||
// set_paypal_options_CIPF($is_sandbox, $client_id, $client_secret);
|
||||
// */
|
||||
// $data = array(
|
||||
// 'is_sandbox' => $is_sandbox,
|
||||
// 'client_id' => $client_id,
|
||||
// 'client_secret' => $client_secret,
|
||||
// );
|
||||
// Plgntls::update_option_safe($option_name, $data);
|
||||
}
|
||||
|
||||
/*
|
||||
'payment_success'=>[
|
||||
'notification_send'=>true,
|
||||
'notification_to'=>'$$__admin_email__$$',
|
||||
'notification_subject'=>"paiement réussi",
|
||||
'notification_message'=>"par ici la monnaie",
|
||||
'confirmation_send'=>true,
|
||||
'confirmation_subject'=>"paiement réussi",
|
||||
'confirmation_message'=>"donne l'argent",
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -37,6 +37,8 @@ function prepare_emails_CIPF($email_name, $user_id) {
|
||||
if (is_null($user_id)) {
|
||||
$user_id = get_current_user_id();
|
||||
}
|
||||
$user = get_user_by('id', $user_id);
|
||||
$user_email = $user->user_email;
|
||||
|
||||
|
||||
$emails_option = Plgntls::get_option_safe($emails_option_object);
|
||||
@@ -60,7 +62,7 @@ function prepare_emails_CIPF($email_name, $user_id) {
|
||||
}
|
||||
if ($email['confirmation_send']) {
|
||||
$tmp_email = array();
|
||||
$tmp_email['to'] = $user_id;
|
||||
$tmp_email['to'] = $user_email;
|
||||
$tmp_email['subject'] = $email['confirmation_subject'];
|
||||
$tmp_email['message'] = $email['confirmation_message'];
|
||||
$tmp_email['headers'] = array('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
@@ -55,7 +55,6 @@ function handle_orders_capture_request_CIPF($request) {
|
||||
try {
|
||||
update_user_post_capture_CIPF($json_response, 'end');
|
||||
|
||||
throw new HttpException('cannot find user with this order_id', 502);
|
||||
return new WP_REST_Response($json_response, $http_status_code);
|
||||
}
|
||||
catch (HttpException $error) {
|
||||
|
||||
Reference in New Issue
Block a user