Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

fix: get_subscriptions api endpoint was not returning subscriptions (#937)

Miguel Ribeirod6329a7af5a4
diff --git a/api/subscriptions/get_subscriptions.php b/api/subscriptions/get_subscriptions.php
index d064a9f..d9d61a4 100644
--- a/api/subscriptions/get_subscriptions.php
+++ b/api/subscriptions/get_subscriptions.php
@@ -146,7 +146,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET
if ($allUserSubscription == 1 && $userId != 1) {
$response = [
"success" => false,
- "title" => "You ask all user subscription but you are not admin"
+ "title" => "Denied. Not admin user"
];
echo json_encode($response);
exit;
@@ -214,11 +214,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET
$sort = "next_payment";
}
- // Construction de la requête SQL principale
+ // Construction of the main SQL Query
+ $params = [];
if ($allUserSubscription == 1 && $userId == 1) {
$sql = "SELECT * FROM subscriptions";
} else {
$sql = "SELECT * FROM subscriptions WHERE user_id = :userId";
+ $params[':userId'] = $userId;
}
if (isset($_REQUEST['member'])) {
diff --git a/includes/version.php b/includes/version.php
index 750fec7..86a1644 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1,3 +1,3 @@
<?php
-$version = "v4.4.0";
+$version = "v4.4.1";
?>
\ No newline at end of file