Page 1 of 1

Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 12:52 am
by justawizard
I'm using this code
<?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS >= 1){ ?>
so that certain content is released to new members - but a new member says they can't see the link to the content - is this because I should set the day number to zero for new members? - I'm dripping content out and they should have immediate access after paying....

Thanks!
David

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 1:22 am
by Cristián Lávaque
Well, if the access should be immediate, then there's no need to check the longevity of the membership, is there? You can just check that they have the right access and that should be enough.

Does that help? :)

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 10:38 am
by justawizard
Well, sort of, let me elucidate: I'm dripping out content in 8 "boot camp stages". Each "stage" is access to a specific page which contains all the meat of that boot camp stage. Each boot camp stage is 10 days apart, dripped out in exact sequence, 1-8. In the sidebar, I put that code and links to the pages based on that time / content drip sequence so that every 10 days, the new boot camp stage "opens up" for them (the link appears in the sidebar). I want them to have access to boot camp stage 1 right away, but I suspect that the php code with registration code I noted above (DAYS >= 1) is preventing that link from showing up until 24 hours since the member joined.

Should I set that to zero instead of 1? How can I make sure that boot camp stage one link shows up right away using that code?

Thanks! : D
David

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 2:31 pm
by Cristián Lávaque
I understand what you're trying to do, and you're doing great. What I meant is that you can use the time since registration for stages 2 to 8, but you don't need to for 1.

Maybe something like this:

Code: Select all
if (current_user_can('access_s2member_level1')) {
    echo '<ul><li><a href="http://yoursite.com/stage1" alt="Stage 1">Stage 1</a></li>';
    $stages = array (
        'Stage 2' => 'http://yoursite.com/stage2',
        'Stage 3' => 'http://yoursite.com/stage3',
        'Stage 4' => 'http://yoursite.com/stage4',
        'Stage 5' => 'http://yoursite.com/stage5',
        'Stage 6' => 'http://yoursite.com/stage6',
        'Stage 7' => 'http://yoursite.com/stage7',
        'Stage 8' => 'http://yoursite.com/stage8',
    );
    $stage_day = 10;
    foreach ($stages as $stage_name => $stage_url) {
        if (S2MEMBER_CURRENT_USER_REGISTRATION_DAYS < $stage_day)
            break;
        echo '<li><a href="', $stage_url, '" alt="', $stage_name, '" />', $stage_name, '</li>';
        $stage_day += 10;
    }
    echo '</ul>';
}
 


I hope that helps. :)

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 3:05 pm
by justawizard
Cristian, you are so helpful! :) - question - if I don't have something there for stage 1 (and there is a link to see that page), then any website visitor can see the link? - oh wait, but unless they're a member they won't go to the actual stage 1 page, they'll just see the "become a member" page? Yikes! Clearly I'm not clear ;)
Thanks!
David

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 3:34 pm
by Cristián Lávaque
:D

As you see, everthing there is enclosed by the condition that the person can access Level 1 content. If the person doesn't have that access, he'll not be shown that at all. He'd be sent to the Membership Options Page if he actually clicked on the link to one of the protected pages, but he wouldn't have the link shown to him without the proper access anyway.

By the way, I assumed you used Level 1, but this could be done checking for a custom capability or another level.

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 3:58 pm
by justawizard
Hey Cristian - yes, I only use s2member level 1.

Unfortunately, I don't know how to code php, but know a little about code, so I used the code provided in s2member about "drip content" and created this in the sidebar for the links to drip out (i didn't copy/paste all 8 boot camps, only first 3 here should reveal my scheme, and also the URLs are not actual):


Code: Select all
<p><a href="http://www.MyWebsite.com/member-home-page/">Member Home Page</a></p>
<p><strong>Seminar Success Boot Camp</strong></p>
<p><?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS >= 1){ ?>
        <a href="http://www.MyWebsite.com/bootcamp1/">Boot Camp Level 1</a>
    <?php ?>
</p>
<p><?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS >= 11){ ?>
        <a href="http://www.MyWebsite.com/ bootcamp2/">Boot Camp Level 2</a>
    <?php ?>
</p>
<p><?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS >= 21){ ?>
        <a href="http://www.MyWebsite.com/ bootcamp3/">Boot Camp Level 3</a>
    <?php ?>
</p>


So, I think the problem is with the first php snippet, correct? If I change that to zero, would it solve my problem? - actually, I take that back - what I should do is just post the link to boot camp 1 "live", and so even though the general public can see it, when they click they can't access it; members will see the boot camp 1 page. And just leave 2-8 intact?

Thanks!
David

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 4:36 pm
by Cristián Lávaque
Yeah, pretty much. If you want to leave the link to stage 1 to tease people that click on it and are sent to the Membership Options Page, you could do that. Since it'd be shown without checking if the person is even logged in, it'll always be shown.

If you check if days > 0, it'll always be true, I assume, not sure how the first day is considered, if 1 or 0. But you want to give access immediately to those that page, so why even check?

You can do the rest using the code I gave you if you want to avoid repetitive code and being able to update it with less lines in the future.

Thinking about it, you could also have the other stages shown in the list, although not linked.

Code: Select all
<p><a href="http://www.mywebsite.com/member-home-page/">Member Home Page</a></p>
<p><strong>Seminar Success Boot Camp</strong></p>
<ul class="stages">
<li class="available"><a href="http://www.mywebsite.com/bootcamp1/" alt="Boot Camp Level 1">Boot Camp Level 1</a></li>
<?php
$stages 
= array (
    'Boot Camp Level 2' => 'http://www.mywebsite.com/bootcamp2/',
    'Boot Camp Level 3' => 'http://www.mywebsite.com/bootcamp3/',
    'Boot Camp Level 4' => 'http://www.mywebsite.com/bootcamp4/',
    'Boot Camp Level 5' => 'http://www.mywebsite.com/bootcamp5/',
    'Boot Camp Level 6' => 'http://www.mywebsite.com/bootcamp6/',
    'Boot Camp Level 7' => 'http://www.mywebsite.com/bootcamp7/',
    'Boot Camp Level 8' => 'http://www.mywebsite.com/bootcamp8/',
);
$stage_day = 10;
foreach ($stages as $stage_name => $stage_url) {
    if (S2MEMBER_CURRENT_USER_REGISTRATION_DAYS > $stage_day) {
        echo '<li class="available"><a href="', $stage_url, '" alt="', $stage_name, '" />', $stage_name, '</li>';
    else
        echo 
'<li class="pending">', $stage_name, '</li>';
    $stage_day += 10;
}
?>
</ul>


The $stages array lets you use any names and URLs for them, if the only thing that changed in them were the number, the could would be even shorter because it just needs a counter. By the way, I added classes to the stages list and the items in it so you could style them.

Just change the names and the URLs in that code and try it. Let me know if works for you. :)

By the way, you'll have to protect the content in the dripping sequence because if you just rely on level to prevent access to the page, someone that guess the URL will see it, so wrap the body of your post with the same condition checking the days.

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 4:57 pm
by justawizard
Admittedly the code you wrote is over my head, but I do "get" the idea of what the php is accomplishing - I'll create a new sidebar and use the code your wrote, and then replace the names & URLs as you suggested and take a look and see how it displays.

This sentence I'm not 100% sure I understand:
"By the way, you'll have to protect the content in the dripping sequence because if you just rely on level to prevent access to the page, someone that guess the URL will see it, so wrap the body of your post with the same condition checking the days."
If you mean my URIs (page names) could be guessed and accessed by any member because I'm only using Level 1 in s2member, I did name my URIs in a unique way, they're not /bootcamp1, /bootcamp2, etc. - was that the concern you were raising?

Thanks again, and I'll try out that code you so nicely provided :) on my site later today!
David

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 5:29 pm
by Cristián Lávaque
I hope the code helps you. :)

Yes, that was my concern, that someone may guess your URLs and just get to the content. By the way, it's not just guessing, finding out may be a better way of saying it. Someone could Google your website to find it, or check out your sitemap. Make sure you're not giving them away there. Also there's the chance of one member sharing the URL with another.

Anyway, it'd be an extra layer of protection to add the conditional wrapping the content to be dripped.

Code: Select all
<?php
$stage 
= 2
$stage_day 
= ($stage - 1) x 10;
if (S2MEMBER_CURRENT_USER_REGISTRATION_DAYS > 10) { ?>

    Here goes the content for this stage.

<?php } else {
    echo 'This stage will be available to you';
    $days_left = ($stage_day + 1) - S2MEMBER_CURRENT_USER_REGISTRATION_DAYS;
    if ($days_left == 1)
        echo 'tomorrow.';
    else
        echo 
'in', $days_left, 'days.';
}
?>


Or something like that.

You can use that same code for all the other stages, just change $stage to the another number and the rest of the variable should update from it.

By the way, this is all untested code, but you already knew that, I guess. I'll be happy to help you until it works. :)

Re: Is This Why New Member Reports No Access?

PostPosted: April 5th, 2011, 11:41 pm
by justawizard
Hey Cristian - Well, here's my status report (no bad news :) ) - I tried the first block of php code, and probably if I played with it enough I could figure out how to make it work. But after some trying I failed, and because I'm behind on studying for the Google Adwords Exam Certification, time constraints mean I have to stop playing with code and start studying.

But, what I did do, is - I decided to make the first bootcamp link "live" and a "tease" as you put it, the tease of course being to non-members who click but only land on the sales letter page.

I also used the pretty link plugin to disguise that links' actual URI (I'll probably do that for the others, but not sure if that's really necessary since those won't be "public".

I did a site: search and found that indeed, I had used the Core Tweaks plugin to create a sitemap which, sure enough, was indexed - and even though it's not publicly accessible, a sharp member could find it, gain access to all the pages that are supposed to be dripped out to them later - so I trashed that page and told Google Webmaster Tools to remove that URL from their index.

I feel bad for not utilizing your so-nicely provided code! - yet! - and as much as I really want to tinker with that code and make it work (or maybe I'll ask one of the php developers at work to explain it to me ;) ) that Adwords Exam awaits, and I've got to get studying!

Thanks again SO much for all your help! :D

David

Re: Is This Why New Member Reports No Access?

PostPosted: April 6th, 2011, 12:31 am
by Cristián Lávaque
You're very welcome!

Let me know when you finally get this set up the way you wanted it. And also ask if you have any other questions.

Good luck with the exam! :)