#8547 added macros _current_username_ and _owner_username_

This commit is contained in:
Daniel Maya 2022-03-08 10:44:24 +01:00
parent 223475d546
commit 7e29cd5a60
1 changed files with 44 additions and 0 deletions

View File

@ -4187,6 +4187,28 @@ function events_get_response_target(
);
}
if (strpos($target, '_owner_username_') !== false) {
if (empty($event['owner_user']) === false) {
$fullname = users_get_user_by_id($event['owner_user']);
$target = str_replace(
'_owner_username_',
io_safe_output($fullname['fullname']),
$target
);
} else {
$target = str_replace('_owner_username_', __('N/A'), $target);
}
}
if (strpos($target, '_current_username_') !== false) {
$fullname = users_get_user_by_id($config['id_user']);
$target = str_replace(
'_current_username_',
io_safe_output($fullname['fullname']),
$target
);
}
return $target;
}
@ -7588,6 +7610,28 @@ function events_get_field_value_by_event_id(
$value = str_replace('_current_user_', $config['id_user'], $value);
}
if (strpos($value, '_owner_username_') !== false) {
if (empty($event['owner_user']) === false) {
$fullname = users_get_user_by_id($event['owner_user']);
$value = str_replace(
'_owner_username_',
io_safe_output($fullname['fullname']),
$value
);
} else {
$value = str_replace('_owner_username_', __('N/A'), $value);
}
}
if (strpos($value, '_current_username_') !== false) {
$fullname = users_get_user_by_id($config['id_user']);
$value = str_replace(
'_current_username_',
io_safe_output($fullname['fullname']),
$value
);
}
return $value;
}