Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass checks argument to sensei_can_user_view_lesson filter #7657

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

merkushin
Copy link
Member

@merkushin merkushin commented Aug 6, 2024

Resolves #7630

In the original issue, the Preview setting didn't work if the user's access expired.

Here, we pass our initial checks to the filter to allow making a final decision inside hooks.

Based on the discussion: #7655 (comment)

Proposed Changes

  • Pass checks argument to sensei_can_user_view_lesson filter.

Testing Instructions

  1. Check the tests pass.
  2. Check Sensei Pro PR: https://github.com/Automattic/sensei-pro/pull/2597

New/Updated Hooks

  • sensei_can_user_view_lesson - $checks param added.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@merkushin merkushin added the Hooks This change adds or modifies one or more hooks. label Aug 6, 2024
@merkushin merkushin added this to the 4.24.2 milestone Aug 6, 2024
@merkushin merkushin requested a review from renatho August 6, 2024 06:04
@merkushin merkushin self-assigned this Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

@merkushin merkushin marked this pull request as ready for review August 6, 2024 06:15
renatho
renatho previously approved these changes Aug 6, 2024
Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
If you decide to apply the change I suggested, feel free to merge after tweaked since it's very small and not super relevant.

includes/sensei-functions.php Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Aug 6, 2024

Test the previous changes of this PR with WordPress Playground.

@merkushin merkushin merged commit 763b07b into trunk Aug 7, 2024
23 checks passed
@merkushin merkushin deleted the update/sensei-can-user-view-lesson-args branch August 7, 2024 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hooks This change adds or modifies one or more hooks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WC Paid Courses: Preview setting for a lesson is ignored when the course access expired
2 participants