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™

Set default EOT for all new members

s2Member Plugin. A Membership plugin for WordPress®.

Set default EOT for all new members

Postby man-O-media » August 8th, 2011, 11:03 pm

Hi again,

How would I go about setting a default EOT for all new members/subscribers including free subscribers?

This is for a sports team site where there will often not be a relation between a payment and a EOT. There is a fee paid by a parent or guardian for a player, both of whom must register but there are multiple other people, coaches, managers, etc. who have an elevated level who pay nothing and more often than not, the payments which are made will be by check and not PayPal.
And at the end of the season, because the next seasons players must tryout and the coaches will often change, etc., everyone who registers should get an EOT of Jan 1 of the next year. So if someone registers today, their EOT would be 1/1/2012. If someone registers Jan 1, 2012, their EOT should be 1/12013.
Unless of course an admin goes in and manually sets a different EOT or they have indeed paid something and gotten a different EOT.

Right now I am manually going in to set each new subscribers EOT but I have already forgotten to set the date once or twice.

Obviously setting a EOT for a new free subscriber does not really achieve anything as I am not auto deleting accounts when the EOT date hits but if all new accounts get the EOT date then all I need to worry about is changing their level.

That all said, I'm not sure how to best handle setting a new EOT for those preexisting accounts who continue to the next year such as a player who makes the team again but I will cross that bridge when I get there.

DP
User avatar
man-O-media
Experienced User
Experienced User
 
Posts: 117
Joined: February 10, 2011

Re: Set default EOT for all new members

Postby Cristián Lávaque » August 9th, 2011, 3:47 pm

If you have s2Member Pro, you could use the import tool to change all the EOTs in bulk. WP Admin -> s2Member -> Import/Export -> Import

About setting the EOT on registration, you could try this:

Create dir/file /wp-content/mu-plugins/s2hacks.php
Code: Select all
<?php
add_action 
('ws_plugin__s2member_during_configure_user_registration', 's2_set_default_eot_time');
function s2_set_default_eot_time($vars = array()) {
    if (!is_admin() && $vars['processed'] === 'yes') {
        update_user_option($vars['user_id'], 's2member_auto_eot_time', strtotime(date('Y') . '-12-31'));
    }
}
?>


Let me know if that works. I hope it 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

Re: Set default EOT for all new members

Postby man-O-media » August 9th, 2011, 9:14 pm

Many thanks Cristián,

If I understand, the code takes the current year and adds Dec 31st... Works for me, I will try it out in a little while.

I presume this will not get in the way of S2s normal operation for setting a EOT for paid items.

As for the import, yes I do have pro, in fact import<>export is one of the reasons I purchased Pro but not for this site and I have not looked at it at all yet.
Anyway, are you suggesting exporting all the users and then re-importing and during the import setting the date? Or just importing a new date into all users?
I suppose that could work in years to come however it is not something for just any Joe so I'm not sure its practical...

DP
User avatar
man-O-media
Experienced User
Experienced User
 
Posts: 117
Joined: February 10, 2011

Re: Set default EOT for all new members

Postby Cristián Lávaque » August 10th, 2011, 11:21 am

Yeah, about the import, I meant exporting the users, updating the EOT date and importing.

The hack should not affect the normal use of s2Member, just set your default s2member_auto_eot_time value on registration, that's it. Please test it and let me know how it goes.
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: Set default EOT for all new members

Postby man-O-media » August 20th, 2011, 11:41 pm

Cristián Lávaque wrote:The hack should not affect the normal use of s2Member, just set your default s2member_auto_eot_time value on registration, that's it. Please test it and let me know how it goes.

I have been stuck on another site the last days so have not had a chance to getback to this but as it ends up, this site has a very similar issue so I have used the same idea.

And yea, it seems to set the EOT date just fine...

Correct me if I am wrong but with the way s2 works, if I have EOT "Fixed-Term Extensions ( auto-extend )?" set to automatically extend existing EOT, because this function has already set the EOT to Dec 31, all future 1 year buy now renewals will always go from that date?


Many thanks, DP
User avatar
man-O-media
Experienced User
Experienced User
 
Posts: 117
Joined: February 10, 2011

Re: Set default EOT for all new members

Postby Cristián Lávaque » August 22nd, 2011, 8:57 pm

Yes. If you create a 1 year buy-now button, it'll extend their paid time until next year's Dec 31st.
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: Google [Bot] and 3 guests

cron