From bc9a5b4b06c5a301a880419846f524e650c7eb9d Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 2 Oct 2019 16:33:44 +0200 Subject: [PATCH] Added new functions getAuthFirstname and getAuthSurname to helper hlp_authentication_helper --- .../helpers/hlp_authentication_helper.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/application/helpers/hlp_authentication_helper.php b/application/helpers/hlp_authentication_helper.php index 740823ff9..194f0b249 100644 --- a/application/helpers/hlp_authentication_helper.php +++ b/application/helpers/hlp_authentication_helper.php @@ -34,3 +34,31 @@ function getAuthUID() return isLogged() ? ($ci->authlib->getAuthObj())->{AuthLib::AO_USERNAME} : null; } + +/** + * If the user is NOT logged then a null value is returned. + * If the user is alredy logged, then it is possible to access to the authentication object + * that contains the firstname of the logged user + * NOTE: if the user is logged with a "foreign" method (ex. Bewerbungstool), + * then it is possible that the firstname is null! + */ +function getAuthFirstname() +{ + $ci =& get_instance(); // get CI instance + + return isLogged() ? ($ci->authlib->getAuthObj())->{AuthLib::AO_NAME} : null; +} + +/** + * If the user is NOT logged then a null value is returned. + * If the user is alredy logged, then it is possible to access to the authentication object + * that contains the surname of the logged user + * NOTE: if the user is logged with a "foreign" method (ex. Bewerbungstool), + * then it is possible that the surname is null! + */ +function getAuthSurname() +{ + $ci =& get_instance(); // get CI instance + + return isLogged() ? ($ci->authlib->getAuthObj())->{AuthLib::AO_SURNAME} : null; +}