Links to protected content do not display at all (Membership 2)

I have noticed that links to protected content do not display at all if the user is not logged in. This seems to only happen if the link is in a "list" format. If it's in a paragraph, then the link still shows up (even if the list and the paragraph are on the same page).

An example of this is here:
(with apologies for the word "membership" which is due to the fact that this is a site for a non-profit is not related to the Membership 2 Pro plugin)

At the top of the page, there is a list. The first link in the list should be "Benefits of Membership" but it's not there. Within the lorem ipsum text, there is also a "Benefits of Membership" link, and it's showing up just fine. If you were to log in, you would see the first link in the list (it's there, trust me :slight_smile: ).

Is there any way to change this behavior? We do want all links to show at all times, regardless of the format, and regardless of their protection level. We want to show messages to end users after they hit the page, so they understand what content they could be getting :slight_smile:


  • Tyler Postle
    • CGO

    Hey kalico,

    I see what you mean, yeah it looks like you are using a custom function that displays a queried list of child pages from a shortcode. That is the reason that link doesn't show but the one in your regular paragraph does.

    Membership 2 excludes protected content from queried lists. ie. recently posted widgets, category list widgets, etc. this was one of our biggest requests back in Membership 1. Members didn't want their protected post titles or category titles to be seen to the public.

    The solution here is to add that list in regular html, like the paragraph below it. ie:

    	<li><a href="#">Link Text 1</a></li>
    	<li><a href="#">Link Text 2</a></li>
    	<li><a href="#">Link Text 3</a></li>
    	<li><a href="#">Link Text 4</a></li>
    	<li><a href="#">Link Text 5</a></li>

    Then it will display the link to everyone :slight_smile:

    To change the logic of excluding or including protected content in those queried lists would be a major customization to the protection logic. I can mark it as a feature request though, perhaps we could add a toggle option in the future.

    If you have any further questions on this just let us know.


  • kalico
    • The Bug Hunter

    Thanks, Tyler Postle

    It's helpful (and interesting!) to know that the exact opposite was a popular feature request. A toggle option would certainly be a helpful feature. +1 for that. :slight_smile:

    The tip to use a manually created list is fine for most average situations; however, I have a more specific problem that may not be so easy to manage.....but perhaps you or someone can suggest a solution.

    We use WP Download Manager Pro plugin. It uses a shortcode to display a list of downloadable resources by category or tag. We even had custom work done to add additional tagging options for our specialized lists of content.

    So it was quite disheartening to get all the planning and implementing done, only to discover that our links immediately vanished as soon as the pages were protected! :slight_frown:

    We really can't just manually curate these lists. It would defeat the entire automated list-generation process we have put into place. We designed it to be automated -- if we add new resources, or remove old ones, the lists are always current because they are generated by WPDM.

    This is a huge setback for us. It doesn't sound like there is any option that can be implemented quickly....but I can't help wondering, would a custom code job be able to fix it, or would it be far too extensive?

    I know sometimes the WPMUDEV gurus will come up with something very unexpected, so I'm just putting this out there for further discussion. :slight_smile:

  • Nastia
    • Support Rock Star

    Hello kalico

    Instead of using Post protection method, you can try to protect the page content partially with the Membership's shortcode.

    Protect the content of the page with:
    [ms-protect-content id=&quot;ID&quot;][/ms-protect-content]

    Replace the "ID" with the membership ID, or you can copy the membership's shortcode from Membership 2 > Memberships, hover over Show text of the membership to reveal the shortcodes list. Please see the attached screenshot:

    I hope this helps!

    Kind Regards,

  • kalico
    • The Bug Hunter

    Nastia That's genius! :slight_smile:

    In testing this, I even discovered that WP Download Manager's template system supports parsing shortcodes -- so I was able to add the [ms-protect-content] shortcode to the WPDM template.

    From a non-tech/maintenance standpoint, this is great. Our staff person only has to select the "protected content" template when they create the download package in WPDM, and the content is protected without any fuss.

    Yay!! Thanks so much for an elegant solution. :slight_smile:

  • kalico
    • The Bug Hunter

    Although not as elegant as Nastia's solution, I will share the plan we had come up with in case it helps someone else who is not using WPDM.

    We had decided to use [ms-protect-content] on the page where our auto-generated list lives. We would make a special message about the available content for those who can't see the links....something like "There is more content available on this page for those who have Membership X. If you need to access it, blah, blah, blah...."

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.