- wip create role at registration
- upgraded shortcode user_infos to output acf format
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user