X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=c9f97c7b212f8f057c1dc78425d2b18761572cb5;hp=9d61c0cf94b87eff600170d7aa895944e83ddc34;hb=57227d33e870ec5cd271209c4a978a52b45c2dd6;hpb=a49d1f4613f3f7d47fb57d946e9f7f705bd34a9b diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 9d61c0cf94..c9f97c7b21 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1,7 +1,7 @@ '; - debug_print_backtrace(); - die(' 1)); @@ -752,8 +763,40 @@ function setCurrentUserId ($userid) { // Getter for current userid function getCurrentUserId () { + // Userid must be set before it can be used + if (!isCurrentUserIdSet()) { + // Not set + debug_report_bug('User id is not set.'); + } // END - if + + // Return the userid return $GLOBALS['current_userid']; } +// Checks if current userid is set +function isCurrentUserIdSet () { + return isset($GLOBALS['current_userid']); +} + +// Checks wether we are debugging template cache +function isDebuggingTemplateCache () { + return (getConfig('DEBUG_TEMPLATE_CACHE') == 'Y'); +} + +// Wrapper for fetchUserData() and getUserData() calls +function getFetchedUserData ($keyColumn, $userId, $valueColumn) { + // Default is 'guest' + $data = getMessage('USERNAME_GUEST'); + + // Can we fetch the user data? + if (($userId > 0) && (fetchUserData($userId, $keyColumn))) { + // Now get the data back + $data = getUserData($valueColumn); + } // END - if + + // Return it + return $data; +} + // [EOF] ?>