From e26215a11fc23aa0ad5ccff8ee97d6c6e8a09c1a Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Thu, 3 Nov 2022 17:26:40 +0000 Subject: [PATCH] fix: extract podcast ids from user groups using a regex --- modules/Auth/Helpers/auth_helper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/Auth/Helpers/auth_helper.php b/modules/Auth/Helpers/auth_helper.php index a87ac811..2d73d9d9 100644 --- a/modules/Auth/Helpers/auth_helper.php +++ b/modules/Auth/Helpers/auth_helper.php @@ -183,7 +183,9 @@ if (! function_exists('get_podcast_groups')) { $userPodcastIds = []; // extract all podcast ids from groups foreach ($podcastGroups as $podcastGroup) { - $userPodcastIds[] = substr((string) $podcastGroup, strpos((string) $podcastGroup, '#') + 1, 1); + // extract podcast id from group and add it to the list of ids + preg_match('~podcast#([0-9]+)-[a-z]+~', $podcastGroup, $matches); + $userPodcastIds[] = $matches[1]; } return $userPodcastIds;