gocodebox / gocodebox/lifterlms

Custom/Third Party Roles Don't Obey Unrestricted Preview Access

Open
#2,180 5 comments 0 reactions 1 assignee Claimed by @thomasplevy View on GitHub
Type: Enhancement
Dominant language
PHP
Stars
212
Forks
140
Avg merge
2d 14h
Merged PRs (30d)
19

Description

### Reproduction Steps

+ HS-192885
+ Create a custom user based on subscriber/student role with user role editor and add the role to the unrestricted preview setting
+ or add Memberium basic user roles to the unrestricted preview setting
+ create a course/lesson/drip or some other locked content
+ switch into the custom or third party user role and attempt to access the content

### Expected Behavior

+ Restricted content should be accessible via the unrestricted preview

### Actual Behavior

+ If the role is based on student, even though you can add them to the preview setting they are still confined to the enroll/drip settings

+ User points to this code as the issue:

```
if ( ! array_intersect( $user->get_user()->roles, $roles ) ) {
return false;
}
```

If he turns false to true he says it works for him to use custom/third party roles.

### Error Messages / Logs

+ Include any relevant error messages or log files
```

```

### System and Environment Information

System Report

```
WordPress
-------------------------------------------

Home Url: [removed]
Site Url: [removed]
Login Url: [removed]/p31/
Version: 5.9.3
Debug Mode: No
Debug Log: No
Debug Display: Yes
Locale: en_US
Multisite: No
Page For Posts: COMPEL Blog (#359) [[removed]/blog/]
Page On Front: Public Home (#25960) [[removed]/]
Permalink Structure: /%postname%/
Show On Front: page
Wp Cron: No

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

Version: 6.4.0
Db Version: 6.4.0
Course Catalog: Course Catalog (#75) [[removed]/course-catalog/]
Membership Catalog: Subscription Options (#310) [[removed]/membership-levels/]
Student Dashboard: New MY COMPEL (#27529) [[removed]/new-my-compel/]
Checkout Page: Not Set
Course Catalog Per Page: 12
Course Catalog Sorting: date,DESC
Membership Catalog Per Page: 9
Membership Catalog Sorting: menu_order,ASC
Site Membership: Not Set
Courses Endpoint: my-courses
Edit Endpoint: edit-my-account
Lost Password Endpoint: lost-password
Vouchers Endpoint: redeem-vouchers
Autogenerate Username: no
Password Strength Meter: yes
Minimum Password Strength: strong
Terms Required: yes
Terms Page: Terms & Conditions (#12937) [[removed]/home/terms-conditions/]
Checkout Names: required
Checkout Address: required
Checkout Phone: optional
Checkout Email Confirmation: yes
Open Registration: no
Registration Names: required
Registration Address: optional
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: US
Currency: USD
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Decimals: 2
Trim Zero Decimals: no
Recurring Payments: no
Email From Address: [removed]
Email From Name: [removed]
Email Footer Text:
Email Header Image: 12919
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
-------------------------------------------

Manual: Enabled
Manual Logging: no
Manual Order: 1

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

Mysql Version: 5.5.5
Php Curl: Yes
Php Default Timezone: UTC
Php Fsockopen: Yes
Php Max Input Vars: 1000
Php Max Upload Size: 128 MB
Php Memory Limit: 1024M
Php Post Max Size: 128M
Php Soap: Yes
Php Suhosin: No
Php Time Limt: 30
Php Version: 7.4.21
Software: Apache
Wp Memory Limit: 1024M

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

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

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

Name: Compel Michigan Child
Version: 3.4
Themeuri: https://test.compeltraining.com/themes/michigan
Authoruri: http://themeforest.net/user/WEBNUS
Template: michigan
Child Theme: Yes
Llms Support: No

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

Akismet Anti-Spam: 4.2.3
bbPress: 2.6.9
BP Profile Search: 5.4.5
BuddyPress: 10.2.0
BuddyPress Activity Plus: 1.6.4
Business Directory Plugin: 6.1
Business Directory Plugin - File Attachments Module: 5.1.2
Business Directory Ratings: 5.2.1
Business Directory ZIP Search: 5.4
Classic Editor: 1.6.2
Contact Form 7: 5.5.6
Duplicate Page: 4.4.8
Easy WP SMTP: 1.4.7
i2SDK: 3.99
LifterLMS: 6.4.0
LifterLMS Assignments: 1.3.0
LifterLMS Helper: 3.4.2
LifterLMS Private Areas: 1.1.5
LifterLMS Social Learning: 1.5.0
Memberium: 2.183
Query Monitor: 3.9.0
Really Simple SSL: 5.3.1
Rename wp-login.php: 2.6.0
Simple Banner: 2.11.0
The Events Calendar: 5.14.2.1
Weblizar Pin It Button On Image Hover And Post: 3.4
Webnus Core: 1.0
Webnus Time Table: 1.0.0
WP-PageNavi: 2.94.0
WP-PostRatings: 1.89
WPBakery Page Builder: 6.9.0
WP Crontrol: 1.12.1
Yoast SEO: 18.7

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

BbPress: Yes
BuddyPress: Yes
LifterLMS Private Areas: Yes
LifterLMS Social Learning: Yes

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

archive-course.php (ver: 3.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: )
archive-llms_membership.php (ver: 3.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
content-no-access-after.php (ver: 4.17.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
content-no-access-before.php (ver: 4.17.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
content-no-access.php (ver: ): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
content-single-lesson-after.php (ver: 3.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: )
content-single-lesson-before.php (ver: 3.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
content-single-quiz-after.php (ver: 3.16.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: 3.16.0)
content-single-quiz-before.php (ver: 3.16.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
course/complete-lesson-link.php (ver: 3.33.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: 3.16.1)
course/lesson-navigation.php (ver: 5.7.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
loop/content.php (ver: 3.14.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: 3.14.0)
loop/loop-end.php (ver: 3.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: 3.0.0)
loop/loop-start.php (ver: 3.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: 3.0.0)
myaccount/dashboard.php (ver: 3.14.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: )
myaccount/form-edit-account.php (ver: 5.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: )
myaccount/navigation.php (ver: 3.17.5): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: 3.0.4)
product/free-enroll-form.php (ver: 5.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: 3.30.0)
product/pricing-table.php (ver: 6.0.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan_child_theme/lifterlms/ (ver: 3.11.1)
quiz/results-attempt-questions-list.php (ver: 5.3.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: 3.16.8)
quiz/results-attempt.php (ver: 3.27.0): /home/p31hos5/stag_compeltraining_com/wp-content/themes/michigan/lifterlms/ (ver: 3.16.8)

```

This issue has be recreated:
+ [x] Locally
+ [x] On a staging site
+ [ ] On a production website
+ [x] With only LifterLMS and a default theme

### Browser, Device, and Operating System Information

+ Browser name and version
+ Operating System name and version
+ Device name and version (if applicable)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.