pmpro-approvals icon indicating copy to clipboard operation
pmpro-approvals copied to clipboard

Approval message for Blocks or Shortcode for users awaiting approval.

Open kimwhite opened this issue 1 year ago • 3 comments

Describe the bug

BLOCKS: A user awaiting approval can see member content in a block using the Enable content visibility for this block for members. and no longer see content for non-members.

SHORTCODE: When using the [membership level="0"] or [membership level="1,2,3"] shortcode, while waiting for approval, the users see nothing. This can make the page blank.

To Reproduce

Steps to reproduce BLOCK behavior:

  1. create a page or post using with two paraphrase blocks
  2. Show one block to All Members and hide the other from All Members.
  3. Sign up with level requiring approval
  4. See Members Only Content

Steps to reproduce SHORTCODE behavior:

  1. create a page or post using two shortcodes. (most often this is a site using a page builder). [membership level="1,2,3,4,5,6"]Will only show up for Members.[/membership] and [membership level="0"]This is what non-members will see.[/membership]
  2. Sign up with a level requiring approval
  3. See nothing.

Screenshots If applicable, please attach a screenshot to make your issue clearer.

Expected behavior Users awaiting Approval should see an approval message on the page.

Isolating the problem (mark completed items with an [x]):

  • [x] I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
  • [x] This bug happens with a default WordPress theme active, or Memberlite.
  • [x] I can reproduce this bug consistently using the steps above.

kimwhite avatar Sep 09 '24 19:09 kimwhite

I recently setup PM Pro and the approval add-on and am finding the same issue of hiding member only pages. The require membership block allows the selection of membership levels but does not restrict based on approval.

rmeske avatar Dec 28 '24 22:12 rmeske

This has been resolved for the Content Visibility Block. The shortcodes don't fully work and nothing is shown. We have to make tweaks possibly to core and Approvals to support this.

In the code we also state we don't support the 0 membership shortcode -> https://github.com/strangerstudios/pmpro-approvals/blob/dev/pmpro-approvals.php#L599-L612

andrewlimaza avatar Jun 12 '25 07:06 andrewlimaza

PMPro Approvals v1.6.2 was released in March 2025, which was after this Issue was opened in September 2024. Here is the updated writeup of where things currently stand:

  • When pending users view a block set to show to members, they will not see the content. If set to show a no-access message, the message will say that they are awaiting approval
  • When pending users view a block set to hide from members, they will see the content.
  • When pending users view the shortcode [membership], they will not see the content.
  • When pending users view the shortcode [membership level='0'], they will not see the content.

The most confusing part here is that the “non-member” restrictions differ depending on whether the content visibility setting or [membership] shortcode are being used.

What is the expected behavior? This isn't 100% clear, but here are some things to keep in mind:

  • If a user is pending, they should not have access to restricted content. Both the block and shortcode already do this successfully and is the most important use-case
  • If a user is pending and they try to view restricted content, it is nice to be able to tell them that they cannot view the content because their membership is pending. The block currently has this option
  • Non-member content is usually upsells with links to checkout, which the user has already completed. Do we want pending users to see this content if they’ve already purchased? The block says yes, the shortcode says no

What are the options moving forwards?

  • Keep the current behavior with a detailed writeup. Additional benefit is that sites that want non-member restrictions to work one way or the other can use the corresponding restriction approach
  • Try to update the shortcode to show non-member content when a membership is pending
  • Try to update the block to hide non-member content when pending (this may not be possible)
  • Create a new shortcode specifically for showing content to pending members to address the gap in the shortcode setup

In the meantime, I have put together a code recipe here that will adjust the shortcode logic to adjust [membership level='0'] so that it will be seen by pending users: https://gist.github.com/dparker1005/4ed551f70455d91612aea0e8c100d521

dparker1005 avatar Jul 17 '25 13:07 dparker1005