Page 1 of 1

EOT date and paypal message

PostPosted: August 16th, 2010, 4:09 pm
by dexterinteractive
My client has a specific date that memberships need to expire. It's an annual membership, but only if you register on day 1 of the cycle. It ends in June, so if you register in August, it's the same price but you don't get the full year, only until the end of June. I'm not sure the best way to administer this, so as not to have to touch the EOT date for each member. Another issue is that I chose the annual option in the button code, and paypal sends an email which basically says it's a year long membership ending a year from the registration date. (which likely isn't true unless they registered on July 1). What can I do here?

Re: EOT date and paypal message

PostPosted: August 17th, 2010, 5:11 pm
by Jason Caldwell
Hi there. Thanks for the great question.

Here is how I would handle this:

1. Whenever you create your PayPal® Button Shortcode, use the "Buy Now / Lifetime" option down at the very bottom of the drop-down menu. Then change the desc="" attribute in your Shortcode; removing references to "Lifetime". Then proceed to step #2.

2. Place a code snippet like this into the functions.php file for your WordPress theme:
Code: Select all
add_action(
"ws_plugin__s2member_during_configure_user_registration_front_side",
"my_fixed_EOT_time"
);

function my_fixed_EOT_time($vars)
   {
      $expire_on = strtotime("YYYY-MM-DD");
      update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
   }

Just change the [ YYYY-MM-DD ] part. You could also add some conditional checks into your routine, to adjust the expiration dynamically, based on the current date, and/or any other factors that you would like to consider. If you are testing this script, you can do print_r($vars) to get a full list of ALL defined variables that you have a reference to. There are MANY of them. $vars["user_id"] is just one.

Re: EOT date and paypal message

PostPosted: June 14th, 2011, 11:50 am
by Cristián Lávaque
Jason, does this hack need to be updated to work with the latest s2Member? Dexter was asking me in another thread. viewtopic.php?f=4&t=10100&p=20705#p20705

Re: EOT date and paypal message

PostPosted: June 15th, 2011, 1:18 am
by Jason Caldwell
Yes, that code should still work as expected.
Please see my reply here:
viewtopic.php?f=4&t=10100&p=20785#p20785