Page 1 of 1

Make content visible/not visible based on EOT?

PostPosted: November 12th, 2011, 3:52 pm
by MarRxK
Hi.

I've been reviewing some of the code here: http://www.primothemes.com/forums/viewtopic.php?f=4&t=14842&hilit=eot+display but can seem to find a way to create a code to do what I would like within a post (using either the exc-php or php-execution plugins).

We use s2member pro to run a membership-based association. Automatic EOT is manually set for December 31st each year. Our members may renew starting November 1 for the following year. I've put a "Buy Now" button on the "Welcome" page that purchases the same level of membership for a one year, non-renewing term with the s2member option to extend remaining EOT set to on (i.e., a purchase extends their membership to December 31 of the following year). I would like, upon returning to the welcome page after renewing, that button to disappear. If there a way to code it such that if the days to EOT are 60 or less, the button appears, but if not, it is not visible?

Thanks!

Mark

Re: Make content visible/not visible based on EOT?

PostPosted: November 12th, 2011, 4:00 pm
by Eduan
You could try content dripping.
WP Admin -> s2Member -> API / Scripting -> s2Member Content Dripping.

Re: Make content visible/not visible based on EOT?

PostPosted: November 12th, 2011, 8:02 pm
by MarRxK
Thanks for the suggestion. I did try that. However, it would appear that one (or just me) cannot make a PayPal button appear within a PHP script. I get all of the text and formatting. However, the PayPal button shows as its text-based shortcode.

Re: Make content visible/not visible based on EOT?

PostPosted: November 12th, 2011, 9:12 pm
by MarRxK
Never mind. Fixed the above button display problem using do_shortcode.

Re: Make content visible/not visible based on EOT?

PostPosted: November 12th, 2011, 9:48 pm
by Eduan
OK, do you have the Exec-PHP plugin installed?
You can't do it without that plugin installed.

Re: Make content visible/not visible based on EOT?

PostPosted: November 13th, 2011, 9:32 am
by MarRxK
Yep. I tried it with both Exec-PHP and PHP-Execution with variable success. I ended up writing a short code to do it. It's not perfect as it uses "echo" instead of "return" to execute the PayPal button, forcing the content to appear at the top of the page. I am not a PHP guru so if anyone wants to help me change from "echo" to "return" so I can place the short code where I would really like it to appear in a post, I'd appreciate it:

Code: Select all
$startdiv '<div class="with-round-borders with-extra-padding with-box-shadows" style="text-align: center; width: 400px; margin-right: auto; margin-left: auto;">You can now renew on-line using PayPal, a credit card, or a debit card! Click the PayPal button below to renew now.<p style="padding-top: 10 px;">';
$enddiv '</p></div>';
        if (
$days get_user_option('s2member_auto_eot_time'))
    {
        
$days ceil(($days time()) / 86400);

        if (
$days 60)
            echo 
$startdiv do_shortcode('[s2Member-PayPal-Button ... /]') , $enddiv;
        else
            echo 
'<strong><center>Thank-you for renewing your membership.</center></strong>';
    }
}
add_shortcode('driprenew''driprenew');
/*end dripping renewal shortcode*/