xtxpatch v 0.1.1 it works fine

This commit is contained in:
asus
2024-03-31 19:59:20 +02:00
parent 995e230e32
commit 5d4be76102
10 changed files with 52 additions and 1527 deletions

View File

@@ -16,6 +16,9 @@ if (!defined('ABSPATH')) {
*
*/
class Xtxpatch {
const ROLE_PROF = 'professeur__professeure';
const ROLE_PARTNER = 'partenaire';
const OPTION_REGISTER_EMAIL = [
'_name'=>'define_email_at_register_xtxpatch',
'_callback'=>__NAMESPACE__.'\define_register_email',

View File

@@ -84,6 +84,53 @@ function define_register_email($request, $option_name, $option_value, $option_de
/*
* ../../../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($send, $user) {
$role_partner = Xtxpatch::ROLE_PARTNER;
$role_prof = Xtxpatch::ROLE_PROF;
$option_register_email = Xtxpatch::OPTION_REGISTER_EMAIL;
$email_option = \Plgntls_xtx::get_option_safe($option_register_email['_name']);
if (user_can($user, $role_prof)) {
$send = $email_option['is_email_prof'];
}
else if (user_can($user, $role_partner)) {
$send = $email_option['is_email_partner'];
}
return $send;
}
add_filter( 'wp_send_new_user_notification_to_user', __NAMESPACE__.'\send_registration_email', 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($wp_new_user_notification_email, $user, $blogname) {
$option_register_email = Xtxpatch::OPTION_REGISTER_EMAIL;
$email_option = \Plgntls_xtx::get_option_safe($option_register_email['_name']);
$wp_new_user_notification_email['message'] = $email_option['email'];
return $wp_new_user_notification_email;
}
add_filter('wp_new_user_notification_email', __NAMESPACE__.'\filter_regitration_email', 21, 3);
?>

View File

@@ -4,7 +4,7 @@ Plugin Name: hggg_xtxpatch
Plugin URI:
Description: some patchs for the xootix login/registration plugin
Author: hugogogo
Version: 0.1.0
Version: 0.1.1
Author URI:
*/