diff --git a/includes/utilities.php b/includes/utilities.php index c27820e..61f273d 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -205,6 +205,16 @@ function fetchVaultRecords($user = null) { * @return int The total balance of the given user (or all users if no user is given). */ function vaultLoop ($name=null) { + $liveBalance = $name === null + ? null + : fetchLiveVaultBalance($name); + + if ($liveBalance !== null) { + return $liveBalance; + } + + // Fallback: derive from stored entries. Used when the live /money call + // fails or is not configured for the user. $pdo = getDatabaseConnection(); if ($name === null) {