Files
2024_WEBSITE_fipf/plugins/cipf_plugin/php/email_registration.php
asus ade0be87ce updated plgntls :
- renamed PLGNTLS_class -> Plgntls
- changed method 'add_to_front()' to static method
- moved fetch script as inline script, so the plgntls file is single
- improved the way inline script and styles are added
2024-03-29 21:56:12 +01:00

118 lines
2.8 KiB
PHP

<?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!');
}
/*
* ../../../wordpress_docker/volumes/wp_volume/wp-includes/pluggable.php
* 2210 : $send_notification_to_user = apply_filters( 'wp_send_new_user_notification_to_user', true, $user );
*
*/
function send_registration_email_CIPF($send, $user) {
Plgntls::debug_infos();
$role_partner = Plgntls::ROLE_PARTNER;
$role_prof = Plgntls::ROLE_PROF;
if (user_can($user, $role_prof)) {
$send = is_email_registration_prof_CIPF();
}
else if (user_can($user, $role_partner)) {
$send = is_email_registration_partner_CIPF();
}
return $send;
}
add_filter( 'wp_send_new_user_notification_to_user', 'send_registration_email_CIPF', 10, 2);
/*
* use this filter to modify the message of the notification email
* you can use the specials custer expansions as $$<field>$$
* ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
* 24 : add_filter( 'wp_new_user_notification_email', array( __CLASS__, 'newuser_notification_email' ), 20, 3 );
*
*/
function filter_regitration_email_CIPF($wp_new_user_notification_email, $user, $blogname) {
Plgntls::debug_infos();
$wp_new_user_notification_email['message'] = get_email_registration_CIPF();
return $wp_new_user_notification_email;
}
add_filter('wp_new_user_notification_email', 'filter_regitration_email_CIPF', 21, 3);
/*
* OPTIONS
*
*/
function set_email_registration_CIPF($email, $is_email_prof, $is_email_partner) {
Plgntls::debug_infos();
$option_email = Plgntls::OPTION_EMAIL;
$option_data = array();
$option_data['email'] = $email;
$option_data['is_email_prof'] = $is_email_prof;
$option_data['is_email_partner'] = $is_email_partner;
update_option($option_email['_name'], serialize($option_data), '', 'no');
}
function get_email_registration_option_CIPF() {
Plgntls::debug_infos();
$option_email = Plgntls::OPTION_EMAIL;
$email_option_serialized = get_option($option_email['_name']);
if (false === $email_option_serialized) {
add_option($option_email['_name'], serialize($option_email['_default']), '', 'no');
$email_option_serialized = get_option($option_email['_name']);
}
return unserialize($email_option_serialized);
}
function get_email_registration_CIPF() {
Plgntls::debug_infos();
$email_option = get_email_registration_option_CIPF();
return $email_option['email'];
}
function is_email_registration_prof_CIPF() {
Plgntls::debug_infos();
$email_option = get_email_registration_option_CIPF();
return $email_option['is_email_prof'];
}
function is_email_registration_partner_CIPF() {
Plgntls::debug_infos();
$email_option = get_email_registration_option_CIPF();
return $email_option['is_email_partner'];
}
?>