Files
2024_WEBSITE_fipf/plugins/cipf_plugin/php/partners_register.php
asus 1fe5379845 v 0.3.12
- update date when transfert success
- role partner at creation ok
2024-03-22 19:10:35 +01:00

579 lines
26 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!');
}
//function check_fields_CIPF($fields) {
// error_log("--- in check_fields_CIPF");
// error_log("fields");
// error_log(json_encode($fields));
//
// $tmp_fields = array_slice($fields, 0);
// error_log("tmp_fields");
// error_log(json_encode($tmp_fields));
// $tmp_fields[] = array(
// "field_type"=>"test",
// "input_type"=>"text",
// "settings"=>array
// (
// "required"=>"yes",
// "label"=>"",
// "cols"=>"onehalf",
// "icon"=>"",
// "placeholder"=>"test",
// "minlength"=>"",
// "maxlength"=>"",
// "class"=>"",
// "active"=>"no",
// "unique_id"=>"test"
// ),
// "priority"=>"10"
// );
// error_log("--tmp_fields");
// error_log(json_encode($tmp_fields));
// error_log("--fields");
// error_log(json_encode($fields));
//
//
// return $fields;
//}
//add_filter('xoo_el_register_fields', 'check_fields_CIPF');
/*
* hook to add a field in the xootix form
* 30 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/templates/global/xoo-el-register-section.php
*
*/
function add_fields_register_CIPF($args) {
PLGNTLS_class::debug_infos();
// error_log("args : " . json_encode($args));
$role_partner = PLGNTLS_class::ROLE_PARTNER;
$slug_partner_registration = PLGNTLS_class::SLUG_PARTNER_REGISTRATION;
$input_hidden_role = PLGNTLS_class::INPUT_HIDDEN_ROLE;
/*
* compare current slug to partner-register slug
* if it match, add a hidden field
*
*/
global $wp;
$current_slug = $wp->request;
if ($current_slug === $slug_partner_registration) {
echo "<input type='hidden' name='$input_hidden_role' value='$role_partner'>";
}
}
add_action('xoo_el_register_add_fields', 'add_fields_register_CIPF');
/*
* filter to modify user before xootix create new user
* 437 : ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
*
* at registration, if form query is for partner
* -> change role to 'partenaire'
*
*/
function add_partenaires_CIPF($customer_data){
PLGNTLS_class::debug_infos();
$role_partner = PLGNTLS_class::ROLE_PARTNER;
$input_hidden_role = PLGNTLS_class::INPUT_HIDDEN_ROLE;
/*
* check query of form submit
* if contains parner, change role for partner
*
*/
if (!isset($_POST[$input_hidden_role])) {
error_log("not set _POST[input_hidden_role]");
return;
}
if ($_POST[$input_hidden_role] === $role_partner) {
error_log("_POST[input_hidden_role] === partner");
$customer_data['role'] = $role_partner;
}
return $customer_data;
}
add_filter('xoo_el_register_new_customer_data', 'add_partenaires_CIPF', 10, 1);
/*
profs :
wp: {
"public_query_vars":{"0":"m","1":"p","2":"posts","3":"w","4":"cat","5":"withcomments","6":"withoutcomments","7":"s","8":"search","9":"exact","10":"sentence","11":"calendar","12":"page","13":"paged","14":"more","15":"tb","16":"pb","17":"author","18":"order","19":"orderby","20":"year","21":"monthnum","22":"day","23":"hour","24":"minute","25":"second","26":"name","27":"category_name","28":"tag","29":"feed","30":"author_name","31":"pagename","32":"page_id","33":"error","34":"attachment","35":"attachment_id","36":"subpost","37":"subpost_id","38":"preview","39":"robots","40":"favicon","41":"taxonomy","42":"term","43":"cpage","44":"post_type","45":"embed","46":"post_format","47":"layout_category","48":"layout_tag","49":"layout_pack","50":"layout_type","51":"module_width","52":"scope","53":"et_tb_item_type","57":"rest_route","58":"sitemap","59":"sitemap-subtype","60":"sitemap-stylesheet","61":"et_code_snippet_type"},
"private_query_vars":["offset","posts_per_page","posts_per_archive_page","showposts","nopaging","post_type","post_status","category__in","category__not_in","category__and","tag__in","tag__not_in","tag__and","tag_slug__in","tag_slug__and","tag_id","post_mime_type","perm","comments_per_page","post__in","post__not_in","post_parent","post_parent__in","post_parent__not_in","title","fields"],
"extra_query_vars":[],
"query_vars":[],
"query_string":"",
"request":"",
"matched_rule":"",
"matched_query":"",
"did_permalink":false
}
_POST: {
"xoo_el_reg_username":"beknomakka",
"xoo_el_reg_email":"beknomakka@gufum.com",
"xoo_el_reg_pass":"pouetpouet",
"_xoo_el_form":"register",
"xoo_el_redirect":"\/redirection_cipf",
"action":"xoo_el_form_action",
"display":"inline"
}
partners :
wp: {"public_query_vars":{"0":"m","1":"p","2":"posts","3":"w","4":"cat","5":"withcomments","6":"withoutcomments","7":"s","8":"search","9":"exact","10":"sentence","11":"calendar","12":"page","13":"paged","14":"more","15":"tb","16":"pb","17":"author","18":"order","19":"orderby","20":"year","21":"monthnum","22":"day","23":"hour","24":"minute","25":"second","26":"name","27":"category_name","28":"tag","29":"feed","30":"author_name","31":"pagename","32":"page_id","33":"error","34":"attachment","35":"attachment_id","36":"subpost","37":"subpost_id","38":"preview","39":"robots","40":"favicon","41":"taxonomy","42":"term","43":"cpage","44":"post_type","45":"embed","46":"post_format","47":"layout_category","48":"layout_tag","49":"layout_pack","50":"layout_type","51":"module_width","52":"scope","53":"et_tb_item_type","57":"rest_route","58":"sitemap","59":"sitemap-subtype","60":"sitemap-stylesheet","61":"et_code_snippet_type"},"private_query_vars":["offset","posts_per_page","posts_per_archive_page","showposts","nopaging","post_type","post_status","category__in","category__not_in","category__and","tag__in","tag__not_in","tag__and","tag_slug__in","tag_slug__and","tag_id","post_mime_type","perm","comments_per_page","post__in","post__not_in","post_parent","post_parent__in","post_parent__not_in","title","fields"],"extra_query_vars":[],"query_vars":[],"query_string":"","request":"","matched_rule":"","matched_query":"","did_permalink":false}
_POST: {
"xoo_el_reg_username":"jardozespi",
"xoo_el_reg_email":"jardozespi@gufum.com",
"xoo_el_reg_pass":"pouetpouet",
"_xoo_el_form":"register",
"cipf_user_role":"partenaire",
"xoo_el_redirect":"\/redirection_cipf",
"action":"xoo_el_form_action",
"display":"inline"
}
*/
/*
*
* ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
*
*/
//function check_created_user_CIPF($customer_id, $new_customer_data) {
// error_log("--- in check_created_user_CIPF");
// error_log("customer_id: " . json_encode($customer_id));
// error_log("new_customer_data: " . json_encode($new_customer_data));
// $user_metas = get_user_meta($customer_id);
// error_log("user metas: " . json_encode($user_metas));
//}
//add_action('xoo_el_created_customer', 'check_created_user_CIPF', 10, 2);
//function temp_test_data_cipf($extra_data) {
// PLGNTLS_class::debug_infos();
// $input_hidden_role = PLGNTLS_class::INPUT_HIDDEN_ROLE;
//
// error_log("- in temp_test_data_cipf, extra data: " . json_encode($extra_data));
// $extra_data[$input_hidden_role] = '';
// error_log("- after, extra data: " . json_encode($extra_data));
// return $extra_data;
//}
//add_filter('xoo_aff_easy-login-woocommerce_data', 'temp_test_data_cipf');
/*
steps :
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
- 257 : function process_registration()
- 273 : get_fields_data() -> reg_admin_fields: {"xoo_el_reg_fname":{"field_type":"xoo_el_reg_fname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"First Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_fname"},"priority":"10"},"xoo_el_reg_lname":{"field_type":"xoo_el_reg_lname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"Last Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_lname"},"priority":"20"},"xoo_el_reg_username":{"field_type":"xoo_el_reg_username","input_type":"text","settings":{"active":"yes","label":"Cr\u00e9er votre identifiant","cols":"one","icon":"fas fa-user-plus","placeholder":"","minlength":"3","maxlength":"20","class":"","unique_id":"xoo_el_reg_username","required":"yes"},"priority":"30"},"xoo_el_reg_email":{"field_type":"xoo_el_reg_email","input_type":"email","settings":{"active":"yes","required":"yes","label":"Votre adresse mail","cols":"one","icon":"fas fa-at","placeholder":"","class":"","unique_id":"xoo_el_reg_email"},"priority":"40"},"xoo_el_reg_pass":{"field_type":"xoo_el_reg_pass","input_type":"password","settings":{"active":"yes","label":"Cr\u00e9ez votre mot de passe","cols":"one","icon":"fas fa-key","placeholder":"8 caract\u00e8res minimum","minlength":"8","maxlength":"100","password_visibility":"yes","class":"","unique_id":"xoo_el_reg_pass","required":"yes"},"priority":"50"},"xoo_el_reg_pass_again":{"field_type":"xoo_el_reg_pass_again","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirm Password","password_visibility":"yes","class":"","active":"no","unique_id":"xoo_el_reg_pass_again","required":"yes"},"priority":"60"},"xoo_el_reg_terms":{"field_type":"xoo_el_reg_terms","input_type":"checkbox_single","settings":{"required":"yes","label":"","placeholder":"The Terms and Conditions","cols":"one","checkbox_single":{"yes":{"checked":"","label":"I accept the <a href=\"privacy-policy\" target=\"_blank\"> Terms of Service and Privacy Policy <\/a>","value":"yes","priority":"10"}},"class":"","active":"no","unique_id":"xoo_el_reg_terms"},"priority":"70"},"xoo-el-username":{"field_type":"xoo-el-username","input_type":"text","settings":{"label":"Identifiant ou email","cols":"one","icon":"fas fa-user-plus","placeholder":"","class":"","unique_id":"xoo-el-username","required":"yes","active":"yes","elType":"login","custom_attributes":{"autocomplete":"username"}},"priority":"80"},"xoo-el-password":{"field_type":"xoo-el-password","input_type":"password","settings":{"label":"Mot de passe","cols":"one","icon":"fas fa-key","placeholder":"","password_visibility":"yes","class":"","unique_id":"xoo-el-password","required":"yes","elType":"login","custom_attributes":{"autocomplete":"current-password"}},"priority":"90"},"xoo-el-rp-pass":{"field_type":"xoo-el-rp-pass","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Nouveau mot de passe","minlength":"6","maxlength":"20","password_visibility":"yes","class":"","unique_id":"xoo-el-rp-pass","required":"yes","elType":"resetpw"},"priority":"100"},"xoo-el-rp-pass-again":{"field_type":"xoo-el-rp-pass-again","input_type":"password","settings":{"required":"yes","unique_id":"xoo-el-rp-pass-again","elType":"resetpw","label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirmer le mot de passe","password_visibility":"yes","class":""},"priority":"110"},"user_login":{"field_type":"user_login","input_type":"text","settings":{"label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":"","unique_id":"user_login","required":"yes","active":"yes","elType":"lostpw"},"priority":"120"},"xoo-el-sing-user":{"field_type":"xoo-el-sing-user","input_type":"text","settings":{"unique_id":"xoo-el-sing-user","required":"yes","active":"yes","elType":"single","custom_attributes":{"autocomplete":"username"},"xoo_el_username":"yes","label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":""},"priority":990}}
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/xoo-form-fields-fw/admin/class-xoo-aff-fields.php
- 39 : public function get_fields_data( $format = 'array' )
-> 47 : return apply_filters( 'xoo_aff_'.$this->plugin_slug.'_data', $data );
- 275 : $doNotValidateOtherFields = get_fields('register') -> doNotValidateOtherFields: ["xoo-el-username","xoo-el-password","xoo-el-rp-pass","xoo-el-rp-pass-again","user_login","xoo-el-sing-user"]
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-fields.php
- 28 : public function get_fields( $type = 'register' )
-> 58 : return apply_filters( 'xoo_el_'.$type.'_fields', $fields );
- 277 : $fieldValues = validate_submitted_field_values( $_POST, $doNotValidateOtherFields ); -> fieldValues: {"xoo_el_reg_username":"nofyobopso","xoo_el_reg_email":"nofyobopso@gufum.com","xoo_el_reg_pass":"pouetpouet"}
- ../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/xoo-form-fields-fw/admin/class-xoo-aff-fields.php
- 1213 : public function validate_submitted_field_values( $values = array(), $do_not_validate_ids = array() )
- 1222 : $fields = $this->get_fields_data()
- list that does not contains the contains the form fields
- values: {"xoo_el_reg_username":"tamludupsi","xoo_el_reg_email":"tamludupsi@gufum.com","xoo_el_reg_pass":"pouetpouet","_xoo_el_form":"register","cipf_user_role":"partenaire","xoo_el_redirect":"\/redirection_cipf","action":"xoo_el_form_action","display":"inline"}
- fields: {
"xoo_el_reg_fname":{"field_type":"xoo_el_reg_fname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"First Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_fname"},"priority":"10"},
"xoo_el_reg_lname":{"field_type":"xoo_el_reg_lname","input_type":"text","settings":{"required":"yes","label":"","cols":"onehalf","icon":"far fa-user","placeholder":"Last Name","minlength":"","maxlength":"","class":"","active":"no","unique_id":"xoo_el_reg_lname"},"priority":"20"},
"xoo_el_reg_username":{"field_type":"xoo_el_reg_username","input_type":"text","settings":{"active":"yes","label":"Cr\u00e9er votre identifiant","cols":"one","icon":"fas fa-user-plus","placeholder":"","minlength":"3","maxlength":"20","class":"","unique_id":"xoo_el_reg_username","required":"yes"},"priority":"30"},
"xoo_el_reg_email":{"field_type":"xoo_el_reg_email","input_type":"email","settings":{"active":"yes","required":"yes","label":"Votre adresse mail","cols":"one","icon":"fas fa-at","placeholder":"","class":"","unique_id":"xoo_el_reg_email"},"priority":"40"},
"xoo_el_reg_pass":{"field_type":"xoo_el_reg_pass","input_type":"password","settings":{"active":"yes","label":"Cr\u00e9ez votre mot de passe","cols":"one","icon":"fas fa-key","placeholder":"8 caract\u00e8res minimum","minlength":"8","maxlength":"100","password_visibility":"yes","class":"","unique_id":"xoo_el_reg_pass","required":"yes"},"priority":"50"},
"xoo_el_reg_pass_again":{"field_type":"xoo_el_reg_pass_again","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirm Password","password_visibility":"yes","class":"","active":"no","unique_id":"xoo_el_reg_pass_again","required":"yes"},"priority":"60"},
"xoo_el_reg_terms":{"field_type":"xoo_el_reg_terms","input_type":"checkbox_single","settings":{"required":"yes","label":"","placeholder":"The Terms and Conditions","cols":"one","checkbox_single":{"yes":{"checked":"","label":"I accept the <a href=\"privacy-policy\" target=\"_blank\"> Terms of Service and Privacy Policy <\/a>","value":"yes","priority":"10"}},"class":"","active":"no","unique_id":"xoo_el_reg_terms"},"priority":"70"},
"xoo-el-username":{"field_type":"xoo-el-username","input_type":"text","settings":{"label":"Identifiant ou email","cols":"one","icon":"fas fa-user-plus","placeholder":"","class":"","unique_id":"xoo-el-username","required":"yes","active":"yes","elType":"login","custom_attributes":{"autocomplete":"username"}},"priority":"80"},
"xoo-el-password":{"field_type":"xoo-el-password","input_type":"password","settings":{"label":"Mot de passe","cols":"one","icon":"fas fa-key","placeholder":"","password_visibility":"yes","class":"","unique_id":"xoo-el-password","required":"yes","elType":"login","custom_attributes":{"autocomplete":"current-password"}},"priority":"90"},
"xoo-el-rp-pass":{"field_type":"xoo-el-rp-pass","input_type":"password","settings":{"label":"","cols":"one","icon":"fas fa-key","placeholder":"Nouveau mot de passe","minlength":"6","maxlength":"20","password_visibility":"yes","class":"","unique_id":"xoo-el-rp-pass","required":"yes","elType":"resetpw"},"priority":"100"},
"xoo-el-rp-pass-again":{"field_type":"xoo-el-rp-pass-again","input_type":"password","settings":{"required":"yes","unique_id":"xoo-el-rp-pass-again","elType":"resetpw","label":"","cols":"one","icon":"fas fa-key","placeholder":"Confirmer le mot de passe","password_visibility":"yes","class":""},"priority":"110"},
"user_login":{"field_type":"user_login","input_type":"text","settings":{"label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":"","unique_id":"user_login","required":"yes","active":"yes","elType":"lostpw"},"priority":"120"},
"xoo-el-sing-user":{"field_type":"xoo-el-sing-user","input_type":"text","settings":{"unique_id":"xoo-el-sing-user","required":"yes","active":"yes","elType":"single","custom_attributes":{"autocomplete":"username"},"xoo_el_username":"yes","label":"","cols":"one","icon":"fas fa-user-plus","placeholder":"Identifiant\/e-mail","class":""},"priority":990}
}
---
do_action( 'xoo_el_created_customer', $customer_id, $new_customer_data);
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-form-handler.php
prof :
customer_id: 194
new_customer_data: {
"user_login":"dultiropso",
"user_pass":"pouetpouet",
"user_email":"dultiropso@gufum.com",
"role":"professeur__professeure"
}
user metas: {
"nickname":["dultiropso"],
"first_name":[""],
"last_name":[""],
"description":[""],
"rich_editing":["true"],
"syntax_highlighting":["true"],
"comment_shortcuts":["false"],
"admin_color":["fresh"],
"use_ssl":["0"],
"show_admin_bar_front":["true"],
"locale":[""],
"wp_503463_capabilities":["a:1:{s:23:\"professeur__professeure\";b:1;}"],
"wp_503463_user_level":["0"],
"dismissed_wp_pointers":[""]
}
partner :
customer_id: 195
new_customer_data: {
"user_login":"mistahirdu",
"user_pass":"pouetpouet",
"user_email":"mistahirdu@gufum.com",
"role":"professeur__professeure"
}
user metas: {
"nickname":["mistahirdu"],
"first_name":[""],
"last_name":[""],
"description":[""],
"rich_editing":["true"],
"syntax_highlighting":["true"],
"comment_shortcuts":["false"],
"admin_color":["fresh"],
"use_ssl":["0"],
"show_admin_bar_front":["true"],
"locale":[""],
"wp_503463_capabilities":["a:1:{s:23:\"professeur__professeure\";b:1;}"],
"wp_503463_user_level":["0"],
"dismissed_wp_pointers":[""]
}
---
do_action( 'xoo_el_register_add_fields', $args );
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/templates/global/xoo-el-register-section.php
args :
{
"display":"inline",
"form_active":"register",
"return":true,
"navstyle":"disable",
"forms":
{
"single":{"enable":"no"},
"login":{"enable":"yes"},
"register":{"enable":"yes"},
"lostpw":{"enable":"yes"}
},
"tabs":["register"]
}
---
function check_data_CIPF($data) {
error_log("--- in check_data_CIPF");
error_log("data");
error_log(json_encode($data));
return $data;
}
add_filter('xoo_aff_easy-login-woocommerce_data', 'check_data_CIPF');
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/xoo-form-fields-fw/admin/class-xoo-aff-fields.php
../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/easy-login-woocommerce/includes/class-xoo-el-fields.php
{
"xoo_el_reg_fname":
{
"field_type":"xoo_el_reg_fname",
"input_type":"text",
"settings":
{
"required":"yes",
"label":"",
"cols":"onehalf",
"icon":"far fa-user",
"placeholder":"First Name",
"minlength":"",
"maxlength":"",
"class":"",
"active":"no",
"unique_id":"xoo_el_reg_fname"
},
"priority":"10"
},
"xoo_el_reg_lname":
{
"field_type":"xoo_el_reg_lname",
"input_type":"text",
"settings":
{
"required":"yes",
"label":"",
"cols":"onehalf",
"icon":"far fa-user",
"placeholder":"Last Name",
"minlength":"",
"maxlength":"",
"class":"",
"active":"no",
"unique_id":"xoo_el_reg_lname"
},
"priority":"20"
},
"xoo_el_reg_username":
{
"field_type":"xoo_el_reg_username",
"input_type":"text",
"settings":
{
"active":"yes",
"label":"Cr\u00e9er votre identifiant",
"cols":"one",
"icon":"fas fa-user-plus",
"placeholder":"",
"minlength":"3",
"maxlength":"20",
"class":"",
"unique_id":"xoo_el_reg_username",
"required":"yes"
},
"priority":"30"
},
"xoo_el_reg_email":
{
"field_type":"xoo_el_reg_email",
"input_type":"email",
"settings":
{
"active":"yes",
"required":"yes",
"label":"Votre adresse mail",
"cols":"one",
"icon":"fas fa-at",
"placeholder":"",
"class":"",
"unique_id":"xoo_el_reg_email"
},
"priority":"40"
},
"xoo_el_reg_pass":
{
"field_type":"xoo_el_reg_pass",
"input_type":"password",
"settings":
{
"active":"yes",
"label":"Cr\u00e9ez votre mot de passe",
"cols":"one",
"icon":"fas fa-key",
"placeholder":"8 caract\u00e8res minimum",
"minlength":"8",
"maxlength":"100",
"password_visibility":"yes",
"class":"",
"unique_id":"xoo_el_reg_pass",
"required":"yes"
},
"priority":"50"
},
"xoo_el_reg_pass_again":
{
"field_type":"xoo_el_reg_pass_again",
"input_type":"password",
"settings":
{
"label":"",
"cols":"one",
"icon":"fas fa-key",
"placeholder":"Confirm Password",
"password_visibility":"yes",
"class":"",
"active":"no",
"unique_id":"xoo_el_reg_pass_again",
"required":"yes"
},
"priority":"60"
},
"xoo_el_reg_terms":
{
"field_type":"xoo_el_reg_terms",
"input_type":"checkbox_single",
"settings":
{
"required":"yes",
"label":"",
"placeholder":"The Terms and Conditions",
"cols":"one",
"checkbox_single":
{
"yes":
{
"checked":"",
"label":"I accept the <a href=\"privacy-policy\" target=\"_blank\"> Terms of Service and Privacy Policy <\/a>",
"value":"yes",
"priority":"10"
}
},
"class":"",
"active":"no",
"unique_id":"xoo_el_reg_terms"
},
"priority":"70"
}
}
*/
/*
* BAD OLD METHOD
* when arriving on the partner registration page
* -> add an option (really not a good idea)
* option is bad, it will be global to all users
*
*/
//function check_if_partner_registration_CIPF() {
// PLGNTLS_class::debug_infos();
// $slug_partner_registration = PLGNTLS_class::SLUG_PARTNER_REGISTRATION;
// $option_partner_slug = PLGNTLS_class::OPTION_PARTNER_SLUG;
//
//
// /*
// * if does not exist, create the option
// */
// if (false === get_option($option_partner_slug['_name'])) {
// add_option($option_partner_slug['_name'], array());
// }
//
// global $wp;
// $current_slug = $wp->request;
// if ($current_slug !== $slug_partner_registration) {
// update_option($option_partner_slug['_name'], $option_partner_slug['false']);
// return;
// }
//
// //PLGNTLS_class::set_partner_registration();
// update_option($option_partner_slug['_name'], $option_partner_slug['true']);
//}
//add_action('template_redirect', 'check_if_partner_registration_CIPF');
/*
* BAD OLD METHOD
* at registration, add role 'partenaire'
* if option (created with hook 'template redirect') has the partner registration slug
* -> give partner role
* option is bad, it will be global to all users
*
*/
//function add_partenaires_CIPF($customer_data){
// PLGNTLS_class::debug_infos();
// $role_partner = PLGNTLS_class::ROLE_PARTNER;
// $option_partner_slug = PLGNTLS_class::OPTION_PARTNER_SLUG;
//
// /*
// */
// $partner_slug_option = get_option($option_partner_slug['_name']);
// $is_partner_slug = false;
// if ($partner_slug_option === $option_partner_slug['true']) {
// $is_partner_slug = true;
// }
// if ($is_partner_slug) {
// $customer_data['role'] = $role_partner;
// }
// return $customer_data;
//}
//add_filter('xoo_el_register_new_customer_data', 'add_partenaires_CIPF', 10, 1);
/*
in add_partenaires
_POST
{
"xoo_el_reg_username":"tistilarde",
"xoo_el_reg_email":"tistilarde@gufum.com",
"xoo_el_reg_pass":"pouetpouet",
"_xoo_el_form":"register",
"xoo_el_redirect":"\/creation-du-compte-partenaire\/",
"action":"xoo_el_form_action",
"display":"popup"
}
_SERVER
{
"SERVER_SOFTWARE":"nginx\/1.20.2",
"REQUEST_URI":"\/wp-admin\/admin-ajax.php",
"USER":"www-data",
"HOME":"\/home\/www-data",
"HTTP_SEC_FETCH_SITE":"same-origin",
"HTTP_SEC_FETCH_MODE":"cors",
"HTTP_SEC_FETCH_DEST":"empty",
"HTTP_COOKIE":"wordpress_test_cookie=WP%20Cookie%20check; wp-postpass_351da2be51e3820c1ef099eec9d2e669=%24P%24BjEiJgHo.cgrpONdnfmxwpIYzraFCP.; mjx.menu=renderer%3ANativeMML%26%3Bsemantics%3Atrue%26%3Bcontext%3ABrowser%26%3Bzoom%3ANone",
"HTTP_REFERER":"https:\/\/local-cipf-plugin.com\/creation-du-compte-partenaire\/",
"HTTP_CONNECTION":"keep-alive",
"HTTP_SEC_GPC":"1",
"HTTP_DNT":"1",
"HTTP_ORIGIN":"https:\/\/local-cipf-plugin.com",
"HTTP_CONTENT_LENGTH":"211",
"HTTP_X_REQUESTED_WITH":"XMLHttpRequest",
"HTTP_CONTENT_TYPE":"application\/x-www-form-urlencoded; charset=UTF-8",
"HTTP_ACCEPT_ENCODING":"gzip, deflate, br",
"HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.5",
"HTTP_ACCEPT":"*\/*",
"HTTP_USER_AGENT":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko\/20100101 Firefox\/123.0",
"HTTP_HOST":"local-cipf-plugin.com",
"REDIRECT_STATUS":"200",
"SERVER_NAME":"local-cipf-plugin.com",
"SERVER_PORT":"443",
"SERVER_ADDR":"172.20.0.4",
"REMOTE_PORT":"58976",
"REMOTE_ADDR":"172.20.0.1",
"GATEWAY_INTERFACE":"CGI\/1.1",
"HTTPS":"on",
"REQUEST_SCHEME":"https",
"SERVER_PROTOCOL":"HTTP\/1.1",
"DOCUMENT_ROOT":"\/var\/www\/html",
"DOCUMENT_URI":"\/wp-admin\/admin-ajax.php",
"SCRIPT_NAME":"\/wp-admin\/admin-ajax.php",
"CONTENT_LENGTH":"211",
"CONTENT_TYPE":"application\/x-www-form-urlencoded; charset=UTF-8",
"REQUEST_METHOD":"POST",
"QUERY_STRING":"",
"SCRIPT_FILENAME":"\/var\/www\/html\/wp-admin\/admin-ajax.php",
"FCGI_ROLE":"RESPONDER",
"PHP_SELF":"\/wp-admin\/admin-ajax.php",
"REQUEST_TIME_FLOAT":1710328883.257681,
"REQUEST_TIME":1710328883
}
*/
?>