lifterlms icon indicating copy to clipboard operation
lifterlms copied to clipboard

Membership restriction on page only shows the first membership

Open NADIA98AKTHER opened this issue 2 years ago • 1 comments
trafficstars

Reproduction Steps

Step 1: Create a page and then add then Enable the Restrict this page from the Membership Access.

Step 2: Add multiple membership.

screely-1694593244521

Step 3: Now view this page on new incognito window or view as a new user. You will see it's only show "You must belong to a x membership"

But it should show all of the membership that added on that restriction box.

Expected Behavior

As we added two membership, it should show that, "You must belong to x or y membership to access the content".

Actual Behavior

It's showing only the first membership on that restriction message

image (12)

System and Environment Information

System Report
Поддержка
-------------------------------------------


WordPress
-------------------------------------------

Home Url: [removed]
Site Url: [removed]
Login Url: [removed]/wp-login.php
Version: 6.3.1
Debug Mode: No
Debug Log: No
Debug Display: Yes
Locale: ru_RU
Multisite: No
Page For Posts: Not Set
Page On Front: Экспресс курс вождения • Онлайн курс вождения • Уроки вождения • Видео уроки вождения (#1058) [[removed]/]
Permalink Structure: /%postname%/
Show On Front: page
Wp Cron: No


Settings
-------------------------------------------

Version: 7.3.0
Db Version: 7.3.0
Course Catalog: Каталог курсов (#4691) [[removed]/courses/]
Membership Catalog: Каталог тарифных планов (#4692) [[removed]/memberships/]
Student Dashboard: Мой кабинет (#4694) [[removed]/dashboard/]
Checkout Page: Покупки (#4693) [[removed]/purchase/]
Course Catalog Per Page: 8
Course Catalog Sorting: menu_order,ASC
Membership Catalog Per Page: 9
Membership Catalog Sorting: menu_order,ASC
Site Membership: Not Set
Courses Endpoint: my-courses
Edit Endpoint: edit-account
Lost Password Endpoint: lost-password
Vouchers Endpoint: redeem-voucher
Autogenerate Username: no
Password Strength Meter: no
Minimum Password Strength: weak
Terms Required: no
Terms Page: Not Set
Checkout Names: hidden
Checkout Address: hidden
Checkout Phone: hidden
Checkout Email Confirmation: no
Open Registration: no
Registration Names: hidden
Registration Address: hidden
Registration Phone: hidden
Registration Voucher: optional
Registration Email Confirmation: no
Account Names: hidden
Account Address: hidden
Account Phone: hidden
Account Email Confirmation: no
Confirmation Endpoint: confirm-payment
Force Ssl Checkout: no
Country: RU
Currency: RUB
Currency Position: right_space
Thousand Separator: ,
Decimal Separator: .
Decimals: 2
Trim Zero Decimals: yes
Recurring Payments: yes
Email From Address: [removed]
Email From Name: [removed]
Email Footer Text: 
Email Header Image: 
Cert Bg Width: 800
Cert Bg Height: 616
Cert Legacy Compat: no


Constants
-------------------------------------------

LLMS_REMOVE_ALL_DATA: undefined
LLMS_REST_DISABLE: undefined
LLMS_SITE_FEATURE_RECURRING_PAYMENTS: undefined
LLMS_SITE_IS_CLONE: undefined


Gateways
-------------------------------------------

Ручной: Disabled
Ручной Logging: yes
Ручной Order: 0


Server
-------------------------------------------

Mysql Version: 5.7.37
Php Curl: Yes
Php Default Timezone: UTC
Php Fsockopen: Yes
Php Max Input Vars: 10000
Php Max Upload Size: 100 МБ
Php Memory Limit: 128M
Php Post Max Size: 100M
Php Soap: Yes
Php Suhosin: No
Php Time Limt: 60
Php Version: 8.2.9
Software: Apache/2.4.6
Wp Memory Limit: 40M


Browser
-------------------------------------------

HTTP USER AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36


Theme
-------------------------------------------

Name: Astra
Version: 4.3.1
Themeuri: https://wpastra.com/
Authoruri: https://wpastra.com/about/?utm_source=theme_preview&utm_medium=author_link&utm_campaign=astra_theme
Template: 
Child Theme: No
Llms Support: Yes


Plugins
-------------------------------------------

Akismet Anti-Spam: Spam Protection: 5.2
AnyComment: 0.3.6
Cache Enabler: 1.8.13
Checkout Field Editor for WooCommerce: 1.9.1
Classic Widgets: 0.3
Code Snippets: 3.4.2
Elementor: 3.16.2
Heartbeat Control by WP Rocket: 2.0.1
LifterLMS: 7.3.0
LifterLMS Assignments: 2.1.0
LifterLMS Helper: 3.5.0
LifterLMS WooCommerce: 2.3.0
Multi Step Form: 1.7.11
PostX - Gutenberg Post Grid Blocks: 3.1.0
Quizle: 1.1.0
Rank Math SEO: 1.0.201.1
Strong Testimonials: 3.1.8
Video Player for YouTube: 1.5.5
Webcraftic Assets manager: 2.1.6
WooCommerce: 8.0.3
WooCommerce Payment Gateway "Продамус.Платежи": 0.0.3


Integrations
-------------------------------------------

BbPress: No
BuddyPress: No
WooCommerce: Yes


Template Overrides
-------------------------------------------




This issue has be recreated:

  • [x] Locally
  • [ ] On a staging site
  • [x] On a production website
  • [x] With only LifterLMS and a default theme

HS-225637

NADIA98AKTHER avatar Sep 14 '23 05:09 NADIA98AKTHER

To implement this, we need to do consider some wide changes in the logic and functionality.

Overview The single membership warning comes from the membership editor. Edit a membership > Membership Settings > Restrictions > Restricted Content Notice. And the restriction redirect also comes from the same place.

Potential Solution If we want to add the notice for multiple membership, we have to ignore the restriction message and redirect from the editor and apply our own. A user can change it through WP filters.

We need to apply checks in the function like

  • if there's a single membership restriction, get the message from editor.
  • if there's multiple membership restriction, use our own.

This is where we're getting the IDs for page/post restriction and sitewide restriction.

actuallyakash avatar Nov 13 '23 09:11 actuallyakash