turnstile

Drupal paywall plugin
Log | Files | Refs | README | LICENSE

commit bb02c397e9b19987f37a4c6498d32dbbf015441f
parent e16733232a9897c78072b4ed9b382bebdcfcbbbb
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 19 Oct 2025 16:56:25 +0200

more minor issues

Diffstat:
Mturnstile.module | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/turnstile.module b/turnstile.module @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\node\NodeInterface; -use GuzzleHttp\Exception\RequestException; /** @@ -103,7 +102,7 @@ function turnstile_entity_view_alter(array &$build, EntityInterface $entity, Ent $order_info = _turnstile_get_node_order_info ($node_id); if ($order_info) { - \Drupal::logger('turnstile')->debug('Found existing order @ORDER for this session.', [ '@ORDER' => $order_info['order_id'] ]); + \Drupal::logger('turnstile')->debug('Found existing order @ORDER_ID for this session.', [ '@ORDER_ID' => $order_info['order_id'] ]); // We have an existing order, check if it was paid $order_id = $order_info['order_id']; $order_status = $api_service->checkOrderStatus($order_info['order_id']); @@ -140,7 +139,7 @@ function turnstile_entity_view_alter(array &$build, EntityInterface $entity, Ent if (!$order_info) { \Drupal::logger('turnstile')->warning('Failed to setup order with Taler merchant backend!'); $config = \Drupal::config('turnstile.settings'); - $grant_access_on_error = $config->get('grant_access_on_error') ?: true; + $grant_access_on_error = $config->get('grant_access_on_error') ?? TRUE; if ($grant_access_on_error) { \Drupal::logger('turnstile')->debug('Could not setup order, disabling Turnstile.'); return; @@ -211,7 +210,7 @@ function _turnstile_grant_subscriber_access($subscription_slug, $expiration) { function _turnstile_is_subscriber($subscription_slug) { $session = \Drupal::request()->getSession(); $access_data = $session->get('turnstile_subscriptions', []); - return ($access_data[$subscription_slug] ?? 0) < time(); + return ($access_data[$subscription_slug] ?? 0) >= time(); }