Page 1 of 1

Setting EOT date on join/renew

PostPosted: June 9th, 2011, 12:42 pm
by dexterinteractive
I think there is a way to do this using the button code, but cannot find the syntax. Currently all members
have an EOT date of 6/30/2011 - (I set this via export/import). I need this EOT date to be changed (to 6/30/2012) upon a member renewing, or a new member joining. Isn't there some way to add this as a field in the button code? Basically the membership ends on this date each year regardless of when you join.

Re: Setting EOT date on join/renew

PostPosted: June 9th, 2011, 7:16 pm
by dexterinteractive
after a bunch of searching, I finally found out how we accomplished this last year. Question is. Is this code still valid, and will it run against existing members (renewals) AND new members?

viewtopic.php?f=4&t=570&hilit=specific+EOT+date

Re: Setting EOT date on join/renew

PostPosted: June 10th, 2011, 12:37 am
by Cristián Lávaque
It may work, the hook is still in the latest version. Test it and see how it goes.

Re: Setting EOT date on join/renew

PostPosted: June 13th, 2011, 4:38 pm
by dexterinteractive
This hook no longer works. Although should it go in functions.php in my theme? or don't you use some kind of hacks.php file?

Re: Setting EOT date on join/renew

PostPosted: June 13th, 2011, 11:21 pm
by Cristián Lávaque
You can create the directory/file /wp-content/mu-plugins/s2hacks.php and use the code there.

Re: Setting EOT date on join/renew

PostPosted: June 14th, 2011, 10:47 am
by dexterinteractive
Still not working. Is there another way to do this?

Here is the code Jason gave me to update this last time, (and it worked in an older version)
I put it in s2-hacks.php as suggested.

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("2012-06-30");
      update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
   } 

Re: Setting EOT date on join/renew

PostPosted: June 15th, 2011, 1:17 am
by Jason Caldwell
Thanks for your inquiry.
~ and thanks for the heads up Cristián.

Yes, this code should still work as expected with s2Member 110606.
Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
    add_action
("ws_plugin__s2member_during_configure_user_registration_front_side","my_fixed_EOT_time");

    function my_fixed_EOT_time($vars)
       {
          $expire_on = strtotime("2012-06-30");
          update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
       } 
?>
If this is not working for you, please post a copy of the Shortcode that you're using for checkout.

Re: Setting EOT date on join/renew

PostPosted: June 15th, 2011, 10:57 am
by dexterinteractive
Here's the shortcode I'm using. I did put the code in that directory.

[s2Member-PayPal-Button level="2" ccaps="" desc="Associate Member Renewal." ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="www.website.org" ta="0" tp="0" tt="D" ra="0.01" rp="1" rt="L" rr="BN" rrt="" rra="1" image="default" output="button" /]

The price is only .01 for testing and I changed the website value for this post.

Re: Setting EOT date on join/renew

PostPosted: June 15th, 2011, 8:05 pm
by Cristián Lávaque
If the term (rt) is set to "lifetime" (L), why would s2Member save an EOT time? It's never meant to expire. WP Admin -> s2Member -> PayPal Buttons -> Shortcode Attributes (Explained) -> rt

Re: Setting EOT date on join/renew

PostPosted: June 17th, 2011, 1:17 am
by Jason Caldwell
Well, he is trying to do fixed EOT times, so Lifetime access is cut short by this custom script; or, it's suppose to be. I'm a little confused by this one, your Shortcode looks good, and your custom script looks good. Just to be certain, does your custom script start with <?php and end with ?>. Also, please make sure there are no extra spaces, line breaks, etc before or after <?php and ?>.

Re: Setting EOT date on join/renew

PostPosted: June 19th, 2011, 5:17 pm
by dexterinteractive
Yes. I double-checked the tags are there and have tested it a few more times. EOT is not updated at all. What's next?

Re: Setting EOT date on join/renew

PostPosted: June 20th, 2011, 5:17 am
by Jason Caldwell
Can you please send me a Dashboard login through this private contact form?
http://www.s2member.com/contact/
We'll take a quick look for you.

Re: Setting EOT date on join/renew

PostPosted: June 20th, 2011, 10:09 am
by dexterinteractive
ok. I submitted it.

Re: Setting EOT date on join/renew

PostPosted: June 22nd, 2011, 1:11 am
by Jason Caldwell
Information received, awaiting confirmation on installation domain.

Re: Setting EOT date on join/renew

PostPosted: June 24th, 2011, 12:49 am
by Jason Caldwell
Details received. Investigating now.

Re: Setting EOT date on join/renew

PostPosted: June 25th, 2011, 12:18 am
by Jason Caldwell
Investigation completed.
So sorry, I've been unable to reproduce this issue on your site. I registered a test user and the custom script did set the EOT Time as expected. Please see the User account ( jasontest ) in your WP Dashboard. If there is more information you can provide about this bug report, please let me know. Thanks!

Re: Setting EOT date on join/renew

PostPosted: June 25th, 2011, 1:01 pm
by dexterinteractive
hmm.. how did you 'register' that account? There is a post called 'Renew Test' that has the button code I've been using.

Try this:

1) Update your 'jasontest' user's EOT to blank.
2) then use my 'Renew Test' button (cost is only .01), and see if it updates EOT now that the member acct already exists.

Maybe the problem is that the code only works for new users? We NEED it to reset EOT for both new users and renewals.

Re: Setting EOT date on join/renew

PostPosted: June 25th, 2011, 8:23 pm
by Jason Caldwell
That's correct, the hack above uses the registration Hook, so it's only going to affect 'registrations', not modifications. The Hook is fired upon this event:
ws_plugin__s2member_during_configure_user_registration_front_side

If you want to cover all of the bases, including modifications, please use this instead:
Code: Select all
<?php
add_action 
("ws_plugin__s2member_during_configure_user_registration_front_side", "my_fixed_EOT_time");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", "my_fixed_EOT_time");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", "my_fixed_EOT_time");
function my_fixed_EOT_time ($vars)
    {
        $expire_on = strtotime ("2012-06-30");
        update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
    }
?>

Re: Setting EOT date on join/renew

PostPosted: December 27th, 2011, 6:41 pm
by Dennis Nolan
This worked great for me. I set up a club membership that follows the calendar year regardless of signup date. I needed an eot of December 31, 2012. I just created a totally blank s2hacks.php file and dropped in the code with the end date I wanted. It works for new members and renewing members. I have S2 member pro but not paypal pro. The alternative of having to manually adjust every signup was a very distressing prospect. Of course, this limits me to only being able to sell 1 year at a time since it affects all signups, but well worth it.

Re: Setting EOT date on join/renew

PostPosted: December 29th, 2011, 4:07 am
by Cristián Lávaque
Thanks for the feedback, Dennis. :)