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

Adding group attribute (accepts a group ID) to pmpro_member shortcode #2966

Merged

Conversation

kimcoleman
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

Added the attribute "group" which accepts a single group ID value so that member info can be shown in the context of a single level group.

Note we still need to show group ID somewhere on the Settings > Levels admin list so that people know what group ID to use.

The logic in this now says:

  • If the shortcode doesn't specify level IDs or a group, grab the first level we find for the user.
  • If the shortcode has a levels attribute, grab the first level the user has in the that array otherwise return nothing.
  • If the shortcode has a group attribute, grab the first level the user has in the that group otherwise return nothing.

How to test the changes in this Pull Request:

  1. Give yourself a level in a group with ID 1
  2. Add a shortcode like [pmpro_member field="membership_name" group="1"] to a post or page
  3. Check the frontend and see your level name.
  4. Now, change the shortcode's group ID attribute to 2 or any other group you don't have a level.
  5. The frontend should show nothing for your membership.

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

  • ENHANCEMENT: Added attribute group to the pmpro_member shortcode to show specific member info in the context of a level group.

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

@dparker1005 dparker1005 merged commit 4e27068 into strangerstudios:dev May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants