Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember General Questions › Navigation and Drip Feed Content
Tagged: Drip content, emember_protected, navigation, page links
- This topic has 4 replies, 2 voices, and was last updated 14 years, 3 months ago by IMGIGClub.
-
AuthorPosts
-
August 7, 2010 at 6:34 pm #1639IMGIGClubMember
I hope there is something obvious that I’m just not thinking of.
I have 6 lessons on a drip-feed ecourse. When a person is on lesson 4, they have access to lessons 1 to 4.
So if a member logs in and views lesson 4, I’d like to have links there to lesson 1, 2 and 3. Easy enough.
Now, if that members clicks to view Lesson 2 – Help! How do I set up Lesson 2 so it has links to Lessons 1-4 when a member at Level 4 views it? When a member at level 2 views Page 2, it should only show links to lessons 1 and 2. (I don’t want to “leak” the title of lessons 3 to 6 to this level 2 member.)
[ Related to this – is there a way to access the member level of the current logged-in member on my pages? If so, I think I can code up my menus the way I want them. ]
August 8, 2010 at 2:45 am #23140amin007ParticipantYou can use section protection for a particular membership level (see the “Section Protection for Specific Membership Level Example” section):
How to Protect a Section of a Post or Page (Partial Protection)
Here is an example code that lets you find out if a member is logged in and what his membership level is:
global $auth;
$user_id = $auth->getUserInfo('member_id');
if (!empty($user_id))
{
//User is logged in so add your conditional code here
$membership_level = $auth->getUserInfo('membership_level');
if($membership_level == 1)
{
//Add stuff for this level
}
}August 8, 2010 at 10:49 am #23141IMGIGClubMemberAmin,
Thank you. I believe I can figure this one out from here.
I appreciate the nice, complete answer. And that was quick, too.
Very nice!
Regards,
Tim
August 8, 2010 at 1:16 pm #23142IMGIGClubMemberAh, and now I need to ask for more help!
When I use the [emember_protected for=3-4-5] [/emember_protected] code blocks things are great when the use is authorized to access the content.
But when the member is not authorized, what I’d like is for basically nothing to happen. What does happen is that a message is printed explaining that there is content on the page that the person cannot access.
What I want this to look like for my Level 3 member:
Step 1 | Step 2 | Step 3 <== These would be links – allowed pages.
Step 4 | Step 5 | Step 6 <== No links – member is not allowed to view.
What does display now:
Step 1 | Hidden content is forbidden for this membership level.
Please Renew your account.Step 2 | Step 3
Step 4 | Step 5 | Step 6
Is there another way to use this function so it does its checks, but does NOT print any error messages?
What I want to have is my 6 page links on every page. The pages a member can access will be enabled with a link; pages they cannot access will simply be text – no link.
Thanks,
Tim
August 8, 2010 at 3:32 pm #23143IMGIGClubMemberOk, using plugin exec-php and the PHP code provided, this works great!
<div style="float: right; margin-right: 30px;">
<?php
global $auth;
$user_id = $auth->getUserInfo('member_id');
if (!empty($user_id))
{
//User is logged in so add your conditional code here
$membership_level = $auth->getUserInfo('membership_level');
if($membership_level >= 3)
{
//Add stuff for this level
echo('Step 1');
}
if($membership_level >= 4)
{
//Add stuff for this level
echo('Step 2');
}
if($membership_level >= 5)
{
//Add stuff for this level
echo('Step 3');
}
if($membership_level >= 7)
{
//Add stuff for this level
echo('Step 4');
}
if($membership_level >=
{
//Add stuff for this level
echo('Step 5');
}
if($membership_level >= 9)
{
//Add stuff for this level
echo('Step 6');
}
}
?>
</div> -
AuthorPosts
- You must be logged in to reply to this topic.