diff --git a/app/Controllers/EpisodeController.php b/app/Controllers/EpisodeController.php
index 5465474e..3d30b4e5 100644
--- a/app/Controllers/EpisodeController.php
+++ b/app/Controllers/EpisodeController.php
@@ -177,10 +177,19 @@ class EpisodeController extends BaseController
$session->set('embed_domain', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST));
}
- $locale = service('request')
- ->getLocale();
-
- $cacheName = "page_podcast#{$this->podcast->id}_episode#{$this->episode->id}_embed_{$theme}_{$locale}";
+ $cacheName = implode(
+ '_',
+ array_filter([
+ 'page',
+ "podcast#{$this->podcast->id}",
+ "episode#{$this->episode->id}",
+ 'embed',
+ $theme,
+ service('request')
+ ->getLocale(),
+ is_unlocked($this->podcast->handle) ? 'unlocked' : null,
+ ]),
+ );
if (! ($cachedView = cache($cacheName))) {
$themeData = EpisodeModel::$themes[$theme];
diff --git a/modules/PremiumPodcasts/Filters/PodcastUnlockFilter.php b/modules/PremiumPodcasts/Filters/PodcastUnlockFilter.php
index a46348e5..74468fa2 100644
--- a/modules/PremiumPodcasts/Filters/PodcastUnlockFilter.php
+++ b/modules/PremiumPodcasts/Filters/PodcastUnlockFilter.php
@@ -67,6 +67,11 @@ class PodcastUnlockFilter implements FilterInterface
return;
}
+ // Episode should be embeddable even if it is premium
+ if ($current === route_to('embed', $episode->podcast->handle, $episode->slug)) {
+ return;
+ }
+
// if podcast is locked then send to the unlock form
/** @var PremiumPodcasts $premiumPodcasts */
$premiumPodcasts = service('premium_podcasts');
diff --git a/themes/cp_app/embed.php b/themes/cp_app/embed.php
index 478e0b2c..26621ea0 100644
--- a/themes/cp_app/embed.php
+++ b/themes/cp_app/embed.php
@@ -33,6 +33,9 @@
= esc($episode->title) ?>
+ is_premium && ! is_unlocked($podcast->handle)): ?>
+
+
+