xtxpatch v 0.1.1 it works fine
This commit is contained in:
@@ -22,20 +22,12 @@ function add_plugin_content_CIPF() {
|
||||
$paypal_credentials = get_paypal_options_CIPF();
|
||||
|
||||
/*
|
||||
* registration email
|
||||
* payment messages
|
||||
*
|
||||
*/
|
||||
$admin_post_email_registration = Plgntls::ADMIN_POST_EMAIL_REGISTRATION;
|
||||
$nonce_email = Plgntls::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
|
||||
$email_registration = get_email_registration_option_CIPF();
|
||||
|
||||
/*
|
||||
* registration email
|
||||
*
|
||||
$admin_post_payment_messages = Plgntls::ADMIN_POST_PAYMENT_MESSAGES;
|
||||
$nonce_payment_messages = Plgntls::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
|
||||
$payment_messages = get_payment_messages_option_CIPF();
|
||||
*/
|
||||
|
||||
ob_start();
|
||||
include(Plgntls::root_path() . '/html/menu/cipf_menu.html');
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
<?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!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* use this hook 'admin_post_{$action}' to receive a form post
|
||||
* https://developer.wordpress.org/reference/hooks/admin_post_action/
|
||||
*
|
||||
* add the url to the action atrtibute of form, and the value of the action in an hidden input
|
||||
* <form method="POST" action="<?php echo admin_url( 'admin-post.php' ); ?>">
|
||||
* <input type="hidden" name="action" value="<?php echo $admin_post_patches; ?>">
|
||||
*
|
||||
*/
|
||||
function change_email_registration_CIPF() {
|
||||
Plgntls::debug_infos();
|
||||
$nonce_email = Plgntls::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
|
||||
|
||||
if (!isset($_POST[$nonce_email['_name']])) {
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
exit;
|
||||
}
|
||||
if (!wp_verify_nonce($_POST[$nonce_email['_name']], $nonce_email['_action'])) {
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
exit;
|
||||
}
|
||||
|
||||
// do actions here
|
||||
update_email_registration_option_CIPF($_POST);
|
||||
|
||||
redirect_menu_referer_CIPF($_POST);
|
||||
}
|
||||
add_action('admin_post_'.Plgntls::ADMIN_POST_EMAIL_REGISTRATION, 'change_email_registration_CIPF');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function update_email_registration_option_CIPF($post) {
|
||||
Plgntls::debug_infos();
|
||||
|
||||
|
||||
/*
|
||||
* email
|
||||
*
|
||||
*/
|
||||
$email = '';
|
||||
if (!isset($post['email'])) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$email = $post['email'];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* is email ?
|
||||
*
|
||||
*/
|
||||
$is_email_prof = false;
|
||||
if (isset($post['is_email_prof']) && $post['is_email_prof'] === 'on') {
|
||||
$is_email_prof = true;
|
||||
}
|
||||
$is_email_partner = false;
|
||||
if (isset($post['is_email_partner']) && $post['is_email_partner'] === 'on') {
|
||||
$is_email_partner = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* update the option with new values
|
||||
*
|
||||
*/
|
||||
set_email_registration_CIPF($email, $is_email_prof, $is_email_partner);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -11,103 +11,6 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ../../../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'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ function randomize_post_output_CIPF($query) {
|
||||
}
|
||||
Plgntls::debug_infos();
|
||||
|
||||
error_log("posts_per_page: " . json_encode($posts_per_page));
|
||||
$query->set('orderby', 'rand');
|
||||
}
|
||||
add_action('pre_get_posts', 'randomize_post_output_CIPF');
|
||||
|
||||
@@ -72,7 +72,6 @@ function redirection_profil_CIPF(){
|
||||
*
|
||||
*/
|
||||
if (current_user_can($role_prof)) {
|
||||
error_log("is prof");
|
||||
$user_page = get_author_posts_url($current_user_id);
|
||||
wp_redirect($user_page, 301);
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user