Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember General Questions › eMember – selective display for members of particular multiple levels
Tagged: emember protected, wp membership
- This topic has 8 replies, 3 voices, and was last updated 6 years, 10 months ago by MagicTH.
-
AuthorPosts
-
August 18, 2013 at 10:04 am #9509mariusdMember
I have 4 levels of users/membership levels: unregistered, registered free, and two paid membership levels.
I want to display certain content to the two paid membership levels and alternative content to the other two levels.
Problem is the shortcode [emember_protected not_for..] only allows for exclusion of one membership level, so that the following does not work:
[emember_protected for=3-4]
[/emember_protected]
[emember_protected not_for=3-4]
[/emember_protected]
I’ve tried inserting code instead with [php_insert], but the PHP Insert plugin seems to have a problem with ‘||’ and does not seem capable of producing the price formatting code in eMember correctly, resulting in an incorrectly displaying fancy product display. Otherwise this route could have worked.
Any ideas how the display of alternative content can be achieved when there is several levels of membership?
August 18, 2013 at 10:49 am #57240mariusdMemberUpdate: I’ve found the solution by taking the php code route and by using another plugin – PHP for Posts, which does not seem to have the same issues as the PHP Insert plugin.
Here is the code inserted using the PHP for Posts plugin:
<?php
if ( wp_emember_is_member_logged_in(4) || wp_emember_is_member_logged_in(3) ) {
echo show_wp_eStore_product_fancy(18,1,1,1,”4|4|1″);
}
else {
echo show_wp_eStore_product_fancy(18,1,1,1,3);
}
?>
Any comments will still be appreciated.
August 18, 2013 at 11:16 pm #57241adminKeymasterYou could also cover it with the following 3 blocks of partial protection:
http://www.tipsandtricks-hq.com/wordpress-membership/how-to-protect-a-section-of-a-post-or-page-88
[emember_protected for=3-4]
Content for members of level 3 and 4
[/emember_protected]
[emember_protected not_for=3-4]
Content for all members who are not in level 3 and 4
[/emember_protected]
[emember_protected scope=not_logged_in_users_only]
Content for non logged in users (non-members)
[/emember_protected]January 13, 2018 at 11:38 pm #57242MagicTHSpectatorI have been using your example from admin above for more than six months. For the past month +/- I have had intermittent failures where nothing appears. Now I have permanent failure of this approach. I cloned that page and if I only have one single group protected, it works. As soon as I try to add more levels it comes back with a blank page. I’m on wp 4.9.1 (and 4.9.0 was failing too).
This works:
[emember_protected for=2-4-5-6-7-8-9 do_not_show_restricted_msg=”1″]
[webinar-links days=”60″ video=”true” audio=”0″]
[/emember_protected]
This fails:
[emember_protected for=4 do_not_show_restricted_msg=”1″]
[webinar-links days=”60″ video=”true” audio=”0″]
[/emember_protected]
[emember_protected for=5 do_not_show_restricted_msg=”1″]
[webinar-links days=”366″ video=”true” audio=”0″]
[/emember_protected]
[emember_protected for=2-6-7-8-9 do_not_show_restricted_msg=”1″]
[webinar-links days=”9999″ video=”true” audio=”0″]
[/emember_protected]
[emember_protected for=3 do_not_show_restricted_msg=”1″]
Copper Members have Blog privileges only
Use Calendar to see available Videos
Click here to upgrade your membership
[/emember_protected]
If you will notice, this calls a php routine where the only difference is the value of the variables. If I could set those based on a conditional of the membership value then I could put then all in one section.
PS: Read prior posts. Most didn’t show the “” around the member values, but I have tried it with and without quotes. Same result; i.e., for=”2-4-5″ and for=2-4-5
I am using this to provide different quantities of protected videos so this is the “meat” of my offering to my paying subscribers.
January 14, 2018 at 3:57 pm #57243MagicTHSpectatorAfter further work on this the problem is not with multiple levels. I have code that affects how many videos are displayed depending on the member level. It’s the same code which works for 60 days and 366 days of videos, but fails when I put in 9999 to show 15 years of videos. Code was working before (I just pass variables changing how much history is allowed.)
It’s also strange that if I create separate pages for each member level then the pages for 60 days and 366 days work fine. It’s only if the page has the 9999 spec it fails EVEN IF YOU ARE NOT EXECUTING THAT CODE because you are not in the level!! Why does just having this code on the page which I assume NEVER EXECUTES if you are not logged in at that level??
January 15, 2018 at 2:03 am #57244adminKeymasterWhich field are you referring to? Can you please tell me where you are using the “9999” value so I can check the code for it?
January 15, 2018 at 9:23 pm #57245MagicTHSpectatorThe input of “9999” refers to how many days of history will be shown. This is in my code, not your. This length varies by membership from 60 days to 366 days (one year) to 9999 days which just means they get everything I have. My code uses WP Query to loop through all pages I have and if a meta field, which is the date the video was created, is newer than today-“xxx” days then it creates a table entry with a link to that video on Amazon S3.
I spent ALL DAY Sunday working this. I tried many variations of code and display.
Bottom line: I am strongly suspicious that the last line of code shown below has a limit of how many times it can be used on one page.
if ( $atts[‘video’] and $stars != ‘T.B.D.’ ) {
$vargs = [‘link’ => $video_link, ‘text’ => $speaker];
$output .= wp_lightbox_anchor_text_protected_s3_video_display( $vargs );
[/CODE]
This creates a link like: [https://denvertradinggroup.com/member-video-platinum#wplu5a5d17exxxxxxx]EVERYTHING in the above code is also used here: [https://denvertradinggroup.com/calendar]
(Try it. This is a public page. Scroll down. The last video is from May 7, 2005)When I use virtually the same code, but add the above piece to get the S3 lightbox links. I found it ONLY WORKS if I limit the time such that no videos older the 9/26/2010 will load. If you look at this page you can see this leaves off 5 videos. I started having this problem about the time the number of my videos increased beyond 97 (we add 2 per month). It was intermittent until the 102nd video was added on 1/11/18.
To simplify:
1. Code without the lightbox_anchor will display all 102 videos.
2. Code with the lightbox_anchor will only load 97 videos.
3. If you try to load more than 97 videos the entire page fails to load at all.Can you confirm a limitation on the number of wp_lightbox_ links that can be on a single page?
[CODE]
if ( $atts and $stars != ‘T.B.D.’ ) {
$vargs = ;
$output .= wp_lightbox_anchor_text_protected_s3_video_display( $vargs );
[/CODE]
This creates a link like: [https://denvertradinggroup.com/member-video-platinum#wplu5a5d17exxxxxxx]
EVERYTHING in the above code is also used here: [https://denvertradinggroup.com/calendar]
(Try it. This is a public page. Scroll down. The last video is from May 7, 2005)
When I use virtually the same code, but add the above piece to get the S3 lightbox links. I found it ONLY WORKS if I limit the time such that no videos older the 9/26/2010 will load. If you look at this page you can see this leaves off 5 videos. I started having this problem about the time the number of my videos increased beyond 97 (we add 2 per month). It was intermittent until the 102nd video was added on 1/11/18.
To simplify:
1. Code without the lightbox_anchor will display all 102 videos.
2. Code with the lightbox_anchor will only load 97 videos.
3. If you try to load more than 97 videos the entire page fails to load at all.
Can you confirm a limitation on the number of wp_lightbox_ links that can be on a single page?
January 15, 2018 at 11:35 pm #57246adminKeymasterThere are no limits when it comes to the number of shortcodes you can use on a page.
However, you may run out of PHP RAM memory if that page is processing too many requests. Try increasing the PHP RAM memory limit of the site. Also, I think you should break those videos into multiple pages then you can have one page that links to the different pages (that will be more user-fiendly)
January 16, 2018 at 12:11 am #57247MagicTHSpectatorThanks. I went to my control panel and the only options they have are to change versions of PHP. I was on 5.6 so I switched to 7.1 (their recommended version). Everything works again. I’m guessing you were right and that 7.1 just has more memory allocated for other reasons.
I’m going to contact my ISP with questions about RAM for both versions.
Regards,
-
AuthorPosts
- You must be logged in to reply to this topic.