Protected Content - Conditionals to display content

Hi there,

I am trying to figure out how to use conditionals to display content protected with the plugin.
Normally, on a page I'd have content that is specific to each membership level (some can see a little, some can see more, some can see all - plus some membership level specific content).

I tried to use the shortcode, embedding each piece of content with the shortcode specific for that membership level, but the outcome is definitely not ideal.
The member with the least amount of access with see the "this content is protected" message for each instance of all the other shortcodes protecting other bits of content!
So I'm sure you guys have figured out a way to use conditionals, rather than the membership level specific shortcodes. But I can't find any info on that!

Thanks for the help!
Cheers

  • Predrag Dubajic

    Hey @emanuele_venditti,

    Hope you're doing well today :slight_smile:

    If I understand you correctly you just want to hide protection messages from your page, right?

    We can do this with little bit of CSS code, you just need to add this code snippet:

    .ms-protection-msg {
        display: none;
    }

    If the theme is not one you made, then you may wish to use a child theme or a plugin like this one for this additional CSS. That way you're protected when you come to upgrade.

    Best regards,
    Predrag

  • emanuele_venditti

    Hi Pedrag,
    and thanks for your reply. No, that is not what I meant. I'll try and explain in different words.

    Say I have a few membership levels set up. Then I have a page with the following:

    [ms-protect-content id="166"]content for guests, non logged in [/ms-protect-content]
    [ms-protect-content id="55"]content for default membership [/ms-protect-content]
    [ms-protect-content id="176"]content for standard membership [/ms-protect-content]
    [ms-protect-content id="56"]content for dripped membership [/ms-protect-content]
    [ms-protect-content id="41"]content for free registered users membership[/ms-protect-content]

    members for membership ID 166 will see the content set up for them, but then they will see

    The content you are trying to access is only available to members. Sorry.
    The content you are trying to access is only available to members. Sorry.
    The content you are trying to access is only available to members. Sorry.
    The content you are trying to access is only available to members. Sorry.

    as there are 4 other blocks of content protected for other membership types.

    I could, as you suggest, hide the "protected content" message, but then it won't appear on pages where it is important to show it, so that people who don't have access to that particular content can be invited to upgrade. Are there any other solutions/options?
    I read somewhere on the forum that a user was nesting shortcodes to achieve something similar. But that is not documented in the plugin manual.
    Cheers!

  • Jon

    The silent="yes" option might help here - it keeps the warning from being reproted to the user.

    [ms-protect-content id="166" silent="yes"]content for guests, non logged in [/ms-protect-content]
    [ms-protect-content id="55" silent="yes"]content for default membership [/ms-protect-content]
    [ms-protect-content id="176" silent="yes"]content for standard membership [/ms-protect-content]
    [ms-protect-content id="56" silent="yes"]content for dripped membership [/ms-protect-content]
    [ms-protect-content id="41" silent="yes"]content for free registered users membership[/ms-protect-content]

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.