- wip create role at registration

- upgraded shortcode user_infos to output acf format
This commit is contained in:
asus
2024-03-13 13:28:14 +01:00
parent f6e092f67d
commit 10ca070d81
4 changed files with 95 additions and 8 deletions

View File

@@ -61,7 +61,7 @@ function output_list_front_CIPF($array) {
}
function format_user_info_CIPF($output, $query, &$current_user, $user_id) {
function format_user_info_CIPF($query, &$current_user, $user_id) {
PLGNTLS_class::debug_infos();
$output_date_format = PLGNTLS_class::USER_INFO_DATE_FORMAT;
@@ -88,6 +88,18 @@ function format_user_info_CIPF($output, $query, &$current_user, $user_id) {
if ($acf_object !== false)
$is_acf = true;
/*
* if is acf, use the acf return format
* otherwise, use the default wordpress value
*
*/
if ($is_acf)
$output = get_field($query, $acf_id);
else
$output = $current_user->$query;
/*
* check if is date
*
@@ -98,6 +110,7 @@ function format_user_info_CIPF($output, $query, &$current_user, $user_id) {
$is_date = true;
}
/*
* if is date, transform format
*
@@ -109,6 +122,7 @@ function format_user_info_CIPF($output, $query, &$current_user, $user_id) {
$output = $date->format($output_date_format);
}
/*
* return the result
*
@@ -217,8 +231,8 @@ function current_user_infos_CIPF($atts) {
$query = $atts;
else
return '';
$output = $current_user->$query;
return format_user_info_CIPF($output, $query, $current_user, $user_id);
// $output = $current_user->$query;
return format_user_info_CIPF($query, $current_user, $user_id);
}
add_shortcode('cipf_user_info', 'current_user_infos_CIPF');