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

Allow level selection on the [pmpro_signup] shortcode. #37

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

louiswol94
Copy link

Two shortcode attributes added:
'levels' (string of level ids to show in selection, or "all" to show all levels, default NULL)
'levels_select' (string - default "dropdown", otherwise radio buttons will show)

All Submissions:

Changes proposed in this Pull Request:

This pull request adds the ability for customers to enable "level selection" on the [pmpro_signup] shortcode. This will enhance the user experience and increase conversion rates. I've had a request to do this for a customer and I thought it would be nice to have this option available in the plugin itself.

I added two attributes for the shortcode:

  • 'levels': The editor to specify which levels should be included in the selection - either by giving "all" or level IDs "1,2,4,5,9". The default is NULL in which case nothing will change.
  • 'levels_select': The editor to specify a dropdown select or radio button select.

The default required 'level' attribute will now just be the default selected/checked item.

I also disabled data attributes like $checkout_boxes, $intro and $title as they relate to an individual Level. But I will still display $intro and $title if custom strings were passed and not just "true".

How to test the changes in this Pull Request:

  1. Test if the normal shortcode is still in tact: [pmpro_signup level="1" login="1" redirect="referrer"]
  2. Show all levels in a dropdown: [pmpro_signup level="1" login="1" redirect="referrer" short="true" levels="all"]
  3. Show specific levels in radio buttons: [pmpro_signup level="1" login="1" redirect="referrer" short="true" levels="1,3" levels_select="radio"]

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.
Enhancement: Optionally allow for level selection on the [pmpro_signup] shortcode.

Two shortcode attributes added:
'levels' (string of level ids to show, or "all" to show all levels, default NULL)
'levels_select' (string - default "dropdpwn", otherwise radio buttons will show)
Enhancement: add class to enable custom styling
@ideadude
Copy link
Member

ideadude commented Jan 5, 2023

This is really cool, but we'll need to update this to match the latest version of the code. There are some sanitization and escaping issues as well. We'll have a look soon.

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.

2 participants