Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Troubleshooting › eMember – partial protection not working
- This topic has 11 replies, 4 voices, and was last updated 5 years, 10 months ago by clearscopedesign.
-
AuthorPosts
-
November 29, 2018 at 8:10 am #15214morsagmonMember
I have the following:
[emember_protected scope="verified_users_only" for=4 do_not_show_restricted_msg=1]
<p style="text-align: center;">[supsystic-price-table id=51]</p>
[/emember_protected]
[emember_protected scope="verified_users_only" for=5 do_not_show_restricted_msg=1]
<h4 style="color:#5FA6C4; text-align: center;">Annual Service is Active For You</h4>
[/emember_protected]
Logged in user belong only to membership level 4.
The second protection segment always allow view (not protecting). This is always showing to the user: “Annual Service is Active For You”.
This is persistent even when I modify the user to belong to level 5. Always ignoring the first segment and opening the second one.
What am I missing?
November 30, 2018 at 12:11 am #78839adminKeymasterThe condition you have there (verified_users_only) in the shortcode means the section be shown to anyone who is logged into the website. That one is not for any level specific task.
For level specific protection, use the following (don’t use the “verified_users_only” scope in there):
[emember_protected for=”5″ do_not_show_restricted_msg=”1″]
Your content goes here
[/emember_protected]
November 30, 2018 at 2:46 pm #78840morsagmonMemberThanks!
December 1, 2018 at 6:40 pm #78841morsagmonMemberOK, the above issue is fixed, but now it’s not working right with stacked membership levels.
Please consider the below:
[emember_protected for=4 not_for="5-6" do_not_show_restricted_msg=1]
Buy Service Agreement message goes here
[/emember_protected]
[emember_protected for="5-6" not_for=4 do_not_show_restricted_msg=1]
Getting help for customers in service agreement goes here
[/emember_protected]
[emember_protected scope="not_logged_in_users_only" do_not_show_restricted_msg=1]
Please log in to get help message goes here
[/emember_protected]
Levels 5, 6 are stacked on top level 4, i.e., they are added levels on top of level 4.
Level 4 is a customer without service agreement.
Levels 5 and 6 are customer on service agreement (either one, or both, grants service).
The above always catches the first section, even if a customer belongs to 4 + 6 levels.
I also tried nesting as follows:
[emember_protected for=4 do_not_show_restricted_msg=1]
[emember_protected not_for="5-6" do_not_show_restricted_msg=1]
Buy Service Agreement message goes here
[/emember_protected]
[/emember_protected]
[emember_protected not_for=4 do_not_show_restricted_msg=1]
[emember_protected for="5-6" do_not_show_restricted_msg=1]
Getting help for customers in service agreement goes here
[/emember_protected]
[/emember_protected]
But it also show the first section always, and also these as text (as if they are missing opening tags):
[/emember_protected]
[/emember_protected]
What am I missing?
December 1, 2018 at 8:40 pm #78842morsagmonMemberOK, I made some progress, but still can’t get the logic to work for all cases.
Basically, these are the rules:
1. Level 5 or 6 = show content.
2. (Level 4 and not (5 or 6)) or (level < 4) = show “buy content” message
3. Not logged-in = show “log-in” message.
I now have the following (not closing the nested protection tag is not a mistake – if included, the second is ignored and just echoed to the browser):
[emember_protected not_for="5-6" do_not_show_restricted_msg=1]
"buy content" message
[/emember_protected]
[emember_protected for="5-6" do_not_show_restricted_msg=1]
[emember_protected for=4 do_not_show_restricted_msg=1]
Show content
[/emember_protected]
[emember_protected scope="not_logged_in_users_only" do_not_show_restricted_msg=1]
Please log-in message
[/emember_protected]
If levels 5 and 6 are not expired, for user belong to 4+5+6, the content shows OK.
The above shows nothing if the user belongs to 4 + 5 + 6 where 6 is expired (but 5 has not yet expired) – a scenario that should show the content, but nothing is shown.
Please advise on the way to solve this, or if the partial protection logic cannot support the above requirements, how would you go about it?
Thanks!
December 4, 2018 at 7:56 pm #78843morsagmonMemberUPDATE:
I simplified things a little bit, created only two segments: for levels 5-6 and not-for levels 5-6. All seems to be working fine now.
December 7, 2018 at 11:48 am #78844clearscopedesignParticipantHello,
Can you please tell us how we can display content for a specific membership level, regardless of whether the account is Active or Expired?
For example the standard shortcode makes the content available if the account is active (but not if it’s expired): [emember_protected for=”2″]
And the expired shortcode makes the content available if the account is expired (but not if it is active): [emember_protected scope=”expired” for=”2″]
How do we make the content available to that membership level whether the account is active or expired?
We tried using [emember_protected scope=”verified_users_only” for=2] but as you have stated above the “verified_users_only” code does not work in this manner.
Can you please tell us what is the proper method of displaying content for a specific membership level, for both Active and Expired states?
Thank you
December 20, 2018 at 5:43 am #78845clearscopedesignParticipantHello,
Could someone please help with this? We would like to be able to display some content on our renewal page that is only for a specific membership level. But we need that content to be viewable by that membership level even if the account is expired.
Could you please help us understand how we can display content for a specific membership level both when the account is Active and when the account is Expired?
Many thanks
December 21, 2018 at 2:13 pm #78846wzpModeratorIn general, shortcodes can’t be nested. You might end up using a combination of PHP tweaks, embedded in your page code:
https://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-miscellaneous-tweaks-248
January 9, 2019 at 9:22 am #78847clearscopedesignParticipantThank you for your reply.
We have tried using the referenced PHP code, however even with that we aren’t quite able to achieve the solution because we need the output within that code to contain an eStore “buy now” shortcode: [wp_eStore_buy_now_button id=20]
All we are wanting to do is to have different renewal options for different membership levels on our renewal page.
Since, as we have covered, the existing eMember shortcodes allow for protecting content for a membership level if the account is EITHER Active OR Expired, but not both, the only solution that we can figure out is to duplicate our content sections and have each renewal option appear multiple times within the code, once with scope=”expired” and once without.
For example, one section using the standard [emember_protected for=”2″] shortcode and then another with the exact same content using the expired attribute [emember_protected for=”2″ scope=”expired”]
This seems like a rather clunky solution, since we have to do this multiple times and it means we have to include and manage several duplicate sections within our page code. But at least it works and achieves the necessary result of having the content display for that membership level in both Active and Expired states.
If there is a simpler way to achieve this result, please do let us know.
Otherwise, we would humbly suggest that it would be an improvement to the eMember plugin to add the allowance for an additional parameter for the scope, to allow for content to be displayed for both Active and Expired states.
For example, scope=”active,expired” or scope=”active-expired”
Thank you
January 9, 2019 at 10:36 pm #78848wzpModeratorwe need the output within that code to contain an eStore “buy now” shortcode: [wp_eStore_buy_now_button id=20]
do_shortcode('[wp_eStore_buy_now_button id=20]');
January 11, 2019 at 2:56 am #78849clearscopedesignParticipantAh got it, thank you!
We have already got things set up now using the duplicate sections but this is very helpful in case we decide to go back to the php method.
Many thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.