some more little codes for restrictions and registrations

This commit is contained in:
asus
2024-03-02 21:43:43 +01:00
parent 7738ad1863
commit 8862bab1bd
16 changed files with 312 additions and 131 deletions

View File

@@ -0,0 +1,29 @@
<?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){
$current_url = $_SERVER['HTTP_REFERER']; // not reliable to use referer, TODO: find another solution
error_log("---");
error_log("uri:");
error_log($_SERVER['REQUEST_URI']);
$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 );
?>