Hide section of a template for non members with membership pro 2

How can I hide a section of a custom content type template with the membership pro 2?

I remember there were something like this in the previous version where you can put part of a text between a pair of shortcodes or php script to hide it from users who don't belong in that subscription group.

Please let me know.

Thanks

  • Michael Bissett

    Hey @Michel, hope you're doing well today! :slight_smile:

    What's the content in question here, could you elaborate on that please?

    There's several methods available, but which one would be more applicable to your situation would depend on how the content's being generated on the page.

    - There's the "More" tag protection, so that anything after the "More" tag would be hidden. You'd access this by going to:

    Membership2 -> Protected Content -> Comments & More Tag

    And setting the appropriate membership for the "Hide "read more" content" option there.

    - There's the shortcodes available, you'll see the shortcode for each membership by going to:

    Membership2 -> Memberships

    And looking at the right side of the page. You'd wrap the content to be protected in the shortcodes, like this:

    [ms-protect-content id="465"]
    Test to be protected.
    [/ms-protect-content id="465"]

    (assuming of course, that the ID for the membership is 465, change that to the ID of your membership here :slight_smile:

    Please advise,
    Michael

  • Michel

    My situation here is, I have a template page created for custom type posts.I would like to hide a section of that template page from users who don't belong to a certain membership group.

    I tried using this format ([ms-protect-content id="465"] and [/ms-protect-content id="465"]) in the php file with the do_shortcode function, I got the protection message but the content that was supposed to be hidden was still showing under that message.

  • Michael Bissett

    Hey @Michel! :slight_smile:

    I'd like to have a closer look at the template code in question, as well as what you're seeing on the page presently, could you please send in the following:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress admin access details (login address, username & password)
    - Include FTP log-in details (hostname, username & password)
    - Mention the file name for the page template
    - Include a link to where this template can be seen in action
    - Include any relevant URLs for your site

    On the contact form (linked to below), please select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks a bunch! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.