Files
2024_WEBSITE_fipf/plugins/cipf_plugin/php/register_partenaires.php
asus faefa98114 - added debug function
- fixed issues in acf fields use
2024-03-10 11:13:44 +01:00

29 lines
736 B
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!');
}
/*
* at registration, add role 'partenaire' when page url has path 'creation-du-compte-partenaire'
*
*/
function add_partenaires_PLGNTLS($customer_data){
PLGNTLS_class::debug_infos();
$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'] = 'partenaire';
return $customer_data;
}
add_filter( 'xoo_el_register_new_customer_data', 'add_partenaires_PLGNTLS', 10, 1 );
?>