Tips and Tricks HQ Support Portal › Forums › WP eMember › WP-eMember nested content protection fo conditional content delivery
- This topic has 8 replies, 5 voices, and was last updated 2 weeks, 1 day ago by
clearscopedesign.
-
AuthorPosts
-
June 17, 2014 at 12:36 pm #11029
FranczV
MemberWe require content protection based on multiple membership levels with compounded access.
For example we currently have 16 different levels to present content based on a geographic location, there are three additional variations required for each of these 16 levels, that would add extra content to each if active.
Is it possible to nest content protection shortcodes (so Group A could have a second membership level added as a conditional so additional Group A content can be displayed) or is it possible to add conditionals to the content protection shortcode based on a custom membership field.
We are aware that we can create Group A, Group A2, Group A3 etc. however this would require us to create 64 membership levels to achieve the desired result.
June 17, 2014 at 2:17 pm #63748wzp
ModeratorIs it possible to nest content protection shortcodes…
This is a WordPress (not an eMember) restriction…
“The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling do_shortcode(). However the parser will fail if a shortcode macro is used to enclose another macro of the same name.”
http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes
…or is it possible to add conditionals to the content protection shortcode based on a custom membership field.
Yes, eMember does support some conditional protection:
http://www.tipsandtricks-hq.com/wordpress-membership/how-to-protect-a-section-of-a-post-or-page-88
Perhaps that might be sufficient. If not, and depending upon the complexity, we are open to suggestions.
June 17, 2014 at 4:50 pm #63749FranczV
MemberSo based on the wordpress limitation, would it be straight forward to create a duplicate shortcode with a different name to enable nesting?
June 17, 2014 at 10:54 pm #63750admin
KeymasterYou should be able to add secondary levels then have nested section/partial protection shortcode.
October 7, 2014 at 3:37 pm #63751phytochem
Member“You should be able to add secondary levels then have nested section/partial protection shortcode.”
Could you provide an example of this?
Thanks
October 7, 2014 at 9:56 pm #63752admin
KeymasterLets say, the primary level is 1 and the secondary level is 2 in this example:
[emember_protected for=1]
Whatever content goes here is only visible by members who belong to level 1
[emember_protected for=2]
Whatever content goes here is only visible by members who belong to level 1 and level 2
[/emember_protected]
[/emember_protected]
October 8, 2014 at 1:32 am #63753phytochem
MemberWhat is the significance and difference of that code with this (see below closing tags):
[emember_protected for=1]
Whatever content goes here is only visible by members who belong to level 1
[/emember_protected]
[emember_protected for=2]
Whatever content goes here is only visible by members who belong to level 1 and level 2
[/emember_protected]
Thank you!
October 8, 2014 at 9:56 pm #63754admin
KeymasterThe second protected block can be seen by users who have level 2 (even if they don’t have level 1).
January 4, 2021 at 8:00 pm #82224clearscopedesign
ParticipantHi,
We are trying to use nested content protection with shortcodes, per reply #63752 above (to make some content available only to members who have both level 1 and level 2). I copied the exact code from that reply and just changed the membership level ID’s accordingly. However, it does not seem to work for us. The second closing [/emember_protected] tag appears as text, and the content doesn’t quite get protected. Could you please help me sort out what we are doing wrong? Do we need to create a duplicate shortcode with a different name to enable nesting, as had been stated by the customer who started this thread?
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.