PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Advanced content hide/reveal

s2Member Plugin. A Membership plugin for WordPress®.

Advanced content hide/reveal

Postby Vahka » October 5th, 2011, 4:10 pm

I have an idea to implement additional content hide/reveal function. That means every new registered member can see new content step by step, pending on join date. Have someone experience with this kind of Wordpress application or can s2meber resolve it?
User avatar
Vahka
Registered User
Registered User
 
Posts: 12
Joined: September 2, 2011
Location: Estonia

Re: Advanced content hide/reveal

Postby surochek » October 5th, 2011, 9:09 pm

That's what I've been trying to do with this, but I'm so rusty I can't see why I get an error:

Code: Select all
<?php if(s2member_registration_time() > 0 and current_user_can(access_s2member_ccap_life) ){ ?>
        This will be displayed to all Members that have registered at some point.
    <?php } ?>
   <?php elseif (s2member_registration_time()> 0 && !current_user_can(access_s2member_ccap_life) ){ ?>
    Please be patient. Your next lesson will be available in due time.
    <?php } ?>
   <?php else { ?>
    Please register for this course to see the lessons.
<?php } ?>


I get the warning:
Parse error: syntax error, unexpected T_ELSEIF in /home/content/89/8190889/html/wordpress/wp-content/plugins/php-execution-plugin/includes/class.php_execution.php(273) : eval()’d code on line 39
User avatar
surochek
Registered User
Registered User
 
Posts: 4
Joined: September 23, 2011

Re: Advanced content hide/reveal

Postby Vahka » October 6th, 2011, 2:47 am

However, find it - S2M include solution. In API/Scripting section just open s2Member Content Dripping and copy the php code. ;)
User avatar
Vahka
Registered User
Registered User
 
Posts: 12
Joined: September 2, 2011
Location: Estonia

Re: Advanced content hide/reveal

Postby Cristián Lávaque » October 6th, 2011, 4:23 am

Vahka, right. :) WP Admin -> s2Member -> API / Scripting -> s2Member Content Dripping

surocheck, let me know if this also gives you the error:

Code: Select all
<?php if (s2member_registration_time() > 0 && current_user_can(access_s2member_ccap_life)) { ?>
This will be displayed to all Members that have registered at some point.
<?php } elseif (s2member_registration_time() > 0 && !current_user_can(access_s2member_ccap_life)) { ?>
Please be patient. Your next lesson will be available in due time.
<?php } else { ?>
Please register for this course to see the lessons.
<?php } ?>


I'm not sure about the logic, though. You say in the first block that it's displayed to anyone that registered at some point, but you don't mention they need the "life" custom capability too. The second block is for those without the custom capability "life" but the message asks to be patient, but the condition doesn't check for a day later.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Advanced content hide/reveal

Postby surochek » October 6th, 2011, 10:32 am

Actually, since the content is protected both at level 0 and by a custom capability, I think I only need this:
Code: Select all

    <?php if (s2member_registration_time() > 0 && current_user_can(access_s2member_ccap_life)) { ?>
    This will be displayed to all Members that have registered at some point.
    <?php } ?>


Then, for successive days:
Code: Select all

    <?php if (s2member_registration_time() > 1 && current_user_can(access_s2member_ccap_life)) { ?>
    This will be displayed to all Members that have registered at some point.
    <?php } elseif (s2member_registration_time() < 1 && current_user_can(access_s2member_ccap_life)) { ?>
    Please be patient. Your next lesson will be available in due time.
    <?php } else { ?>
    Please register for this course to see the lessons.
    <?php } ?>
User avatar
surochek
Registered User
Registered User
 
Posts: 4
Joined: September 23, 2011

Re: Advanced content hide/reveal

Postby surochek » October 9th, 2011, 3:16 pm

However, if anyone registers for a second course later, the content of that second course will be revealed all at once, and I'm back to not knowing what to do.
User avatar
surochek
Registered User
Registered User
 
Posts: 4
Joined: September 23, 2011

Re: Advanced content hide/reveal

Postby Cristián Lávaque » October 11th, 2011, 12:28 pm

But if you're managing the access to the course using custom capabilities, you can create new conditionals for it to drip it, just like you do for the first one. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Advanced content hide/reveal

Postby surochek » October 11th, 2011, 1:45 pm

It's *my* logic that's not functioning these days.

In other words,
Code: Select all
<?php if (s2member_registration_time() > 0 
     
&& current_user_can(access_s2member_ccap_life)) { ?>

will affect ccap "life" but not ccap "lifeTwo"
whereas
Code: Select all
<?php if (s2member_registration_time() > 0 
    
&& current_user_can(access_s2member_ccap_lifeTwo)) { ?>

will affect ccap "lifeTwo" but not ccap "life"

Even though the member is always on level 0...

So I can drip them successively to the same member?

(weird kind of beginner at coding here, yes, apologies for what may be a very obvious statement)
User avatar
surochek
Registered User
Registered User
 
Posts: 4
Joined: September 23, 2011

Re: Advanced content hide/reveal

Postby Cristián Lávaque » October 12th, 2011, 3:22 pm

I see your problem. Don't worry, you're doing well for a beginner. :)

Code: Select all
<?php if (s2member_registration_time() > && (current_user_can(access_s2member_ccap_life) || current_user_can(access_s2member_ccap_lifeTwo))) { ?>


Let me know if this helps.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron