commit 5c1251397d1fc160326885fc17cd72f592d945ba
parent bcd22155c6cbc4aae1611a1e3351e1a4a22e57a8
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 3 Nov 2025 16:39:25 +0100
fix typo, improve backwards compatibility
Diffstat:
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/includes/class-content-filter.php b/includes/class-content-filter.php
@@ -83,13 +83,14 @@ class Taler_Content_Filter {
$full_subscriptions = Taler_Price_Category::get_full_subscriptions($price_category['prices']);
foreach ($full_subscriptions as $subscription_id) {
if (self::is_subscriber($subscription_id)) {
- error_log('Taler Turnstile: Subscriber detected, granting access');
+ debug_log('Subscriber access granted');
return $content;
}
}
// Check if this session already has access
if (self::has_session_access($post->ID)) {
+ debug_log('Session access already granted');
return $content;
}
@@ -99,11 +100,11 @@ class Taler_Content_Filter {
$order_status = Taler_Merchant_API::check_order_status($order_info['order_id']);
if ($order_status && $order_status['paid']) {
- error_log('Taler Turnstile: Order was paid, granting session access');
+ info_log('Taler Turnstile: Order was paid, granting session access');
self::grant_session_access($post->ID);
if (!empty($order_status['subscription_slug'])) {
- error_log('Taler Turnstile: Subscription was purchased, granting subscription access');
+ info_log('Taler Turnstile: Subscription was purchased, granting subscription access');
self::grant_subscriber_access(
$order_status['subscription_slug'],
$order_status['subscription_expiration']
@@ -128,17 +129,18 @@ class Taler_Content_Filter {
// Need to create a new order if we don't have a valid one
if (!$order_info) {
+ info_log('Creating new order for ' . $post->ID);
$order_info = Taler_Merchant_API::create_order($post->ID);
}
if (!$order_info) {
- error_log('Taler Turnstile: Failed to setup order with Taler merchant backend');
$grant_access_on_error = get_option('taler_turnstile_grant_access_on_error', false);
if ($grant_access_on_error) {
error_log('Taler Turnstile: Could not setup order, disabling Turnstile');
return $content;
}
+ error_log('Taler Turnstile: Failed to setup order with Taler merchant backend, returning error page');
return self::render_error_message();
}
@@ -146,6 +148,7 @@ class Taler_Content_Filter {
// Store order info in session
self::store_order_node_mapping($post->ID, $order_info);
+ info_log('Showing paywall page for ' . $post->ID);
// User needs to pay - show teaser + payment button
return self::render_paywall($post, $order_info);
}
diff --git a/includes/class-price-category.php b/includes/class-price-category.php
@@ -78,9 +78,10 @@ class Taler_Price_Category {
$max_cache = time() + 3600;
$choices = array();
$prices = $category['prices'];
+
foreach ($category['prices'] as $token_family_slug => $currency_map) {
if ($token_family_slug !== '%none%') {
- $subscription = $subscriptions[$tokenFamilySlug];
+ $subscription = $subscriptions[$token_family_slug];
$expi = $subscription['valid_before_s'] ?? 0;
if ($expi < time())
continue; // already expired
diff --git a/includes/class-taler-merchant-api.php b/includes/class-taler-merchant-api.php
@@ -216,7 +216,7 @@ class Taler_Merchant_API {
'name' => $family['name'],
'label' => $slug,
'valid_before_s' => $valid_before,
- 'description' => $family['description'],
+ 'description' => $family['description'] ?? 'no description (outdated backend)',
'description_i18n' => ($family['description_i18n'] ?? NULL)
);
}