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

Allow [lifterlms_hide_content/] shortcode to accept multiple IDs #680

Merged
merged 3 commits into from Oct 29, 2018

Conversation

Projects
None yet
2 participants
@yojance
Contributor

yojance commented Oct 6, 2018

Description

See #492

This pull request brings the ability to pass multiple IDs to the lifterlms_hide_content shortcode. The relation option is introduced to the lifterlms_hide_content shortcode, allowing you to calculate access to content with different requirements. The new relation parameter defaults to all and the other possible value is any.

How has this been tested?

  • Imported the Sample course and cloned it so that I would end up with 2 courses with IDs 5 and 27.
  • I then proceeded to enroll myself in Course ID 5
  • Created page and tested the following shortcode combinations with success. Extra spaces and commas were added on purpose to make sure the shortcode wouldn't break and still perform as expected.

[lifterlms_hide_content id=" 5," message="You don't have access to this content." relation="all"]Premium Content[/lifterlms_hide_content]

[lifterlms_hide_content id=" 5, ,, 27" message="You don't have access to this content." relation="all"]Premium Content[/lifterlms_hide_content]

[lifterlms_hide_content id=" 5, 27" message="You don't have access to this content." relation="any"]Premium Content[/lifterlms_hide_content]

[lifterlms_hide_content membership=" 5," message="You don't have access to this content." relation="all"]Premium Content[/lifterlms_hide_content]

[lifterlms_hide_content membership=" 5, 27" message="You don't have access to this content." relation="all"]Premium Content[/lifterlms_hide_content]

[lifterlms_hide_content membership=" 5, 27" message="You don't have access to this content." relation="any"]Premium Content[/lifterlms_hide_content]

The result I saw on the page was:

Premium Content
You don't have access to this content.
Premium Content

Premium Content
You don't have access to this content.
Premium Content

Types of changes

What types of changes does your code introduce?

The relation option is introduced to the lifterlms_hide_content shortcode, allowing you to calculate access to content with different requirements.

@thomasplevy thomasplevy self-assigned this Oct 15, 2018

@thomasplevy thomasplevy merged commit d216ae1 into gocodebox:master Oct 29, 2018

1 of 2 checks passed

codeclimate 2 issues to fix
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment