- removed custom user function and put it in custer
- changed main file for cipf instead of fipfcard - reset some fields after prof form validation
This commit is contained in:
92
plugins/cipf_plugin/php/partners_register.php
Normal file
92
plugins/cipf_plugin/php/partners_register.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?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!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* at registration, add role 'partenaire' when page url has path 'creation-du-compte-partenaire'
|
||||
*
|
||||
*/
|
||||
function add_partenaires_CIPF($customer_data){
|
||||
PLGNTLS_class::debug_infos();
|
||||
$role_partner = PLGNTLS_class::ROLE_PARTNER;
|
||||
|
||||
$current_url = $_SERVER['HTTP_REFERER']; // not reliable to use referer, TODO: find another solution
|
||||
$path_brut = parse_url($current_url, PHP_URL_PATH);
|
||||
$path = trim($path_brut, '/');
|
||||
if ($path === 'creation-du-compte-partenaire')
|
||||
$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
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user