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

Check sensei_user_can_register_for_course filter when My Courses Page is not set #2865

Merged
merged 2 commits into from Jan 27, 2020

Conversation

JuanchoPestana
Copy link
Contributor

Fixes #2858

Changes proposed in this Pull Request:

  • Apply sensei_user_can_register_for_course filter when the "My courses page" is not set

The conditional statement in line 3091 is responsible for checking whether to show the "My courses" page as the registration form, or to show the default WordPress register form (the wp_register() inside the else on line 3097). The issue here is, that when entering that else on line 3097, the filter in discussion is not applied; causing the register button to appear.

Testing instructions:

  1. Go to Settings > General and ensure the setting "Anyone can register" is set.
  2. Go to Sensei LMS > Settings and ensure the "My Courses Page" setting is set to a page.
  3. Add the code snippet: add_filter( 'sensei_user_can_register_for_course', '__return_false' );
  4. In a logged-out window, visit the course. You should not see the Register button. This is the correct behaviour.
  5. Now, go to Sensei LMS > Settings and unset the "My Courses Page" setting (i.e. set it to "Select a Page:").
  6. In a logged-out window, visit the course. You should not see the Register button. This is the correct behaviour.

Proposed changelog entry for your changes:

  • Apply sensei_user_can_register_for_course filter when the "My courses page" is not set.

@donnapep donnapep added this to the 3.0.0 milestone Jan 27, 2020
@donnapep donnapep merged commit b836bfb into Automattic:master Jan 27, 2020
@donnapep donnapep changed the title Fix 2858: Apply filter when my-courses page not set Check sensei_user_can_register_for_course filter when My Courses Page is not set Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register button is not hidden properly by filter
2 participants