Community Support Forums — WordPress® ( Users Helping Users ) — 2011-06-20T21:54:41-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=10113 2011-06-20T21:54:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=21262#p21262 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
We hope to improve this in a future release of s2Member.

Statistics: Posted by Cristián Lávaque — June 20th, 2011, 9:54 pm


]]>
2011-06-20T11:18:29-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=21230#p21230 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
Here's an update on how all this works through a bunch of testing:

The following code in the s2-hacks.php file works:

Code:
add_filter("ws_plugin__s2member_preserve_paid_registration_times", "__return_true");


It preserves the values in this associative array variable:
s2member_paid_registration_times


It does not preserve these variables:
s2member_auto_eot_time, s2member_last_payment_time
. These get erased under all situations I've tested.

So, for my particular situation (any anyone else who may have a similar need of retaining expired member's last payment dates), I'll consult this variable (s2member_paid_registration_times) when the s2member_last_payment_time variable is NULL or blank. s2member_paid_registration_times will return an array of all last payment times for each member level, so I just loop through those, find the most recent if multiple exist.

Code:
<?
$prts_arr = get_user_option("s2member_paid_registration_times", $user_id);
            
while( $element = each( $prts_arr ) )
{
   echo $element[ 'key' ];
   echo ' - ';
   echo date("Y-m-d", $element[ 'value' ]);
   echo '<br />';
}
?>


To retain an expired Member's EOT variable value, my script will go in and pull the latest "Demotion Message" within the wp_s2member_notes variable.

Kind of a wraparound way of getting this info, but I think it will work.

Thanks for your help, and maybe this will help others also...

- Adam

Statistics: Posted by adamarling — June 20th, 2011, 11:18 am


]]>
2011-06-19T19:45:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=21169#p21169 <![CDATA[Re: EOT Value Remains Post-Expiration?]]> "__return_false"? I like to trial-and-error just in case lol.

Statistics: Posted by Cristián Lávaque — June 19th, 2011, 7:45 pm


]]>
2011-06-19T17:14:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=21161#p21161 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
Sorry, I placed that code and the Automatic EOT function still erased my Last Payment Time value. I'll play around with some variations...

- Adam

Statistics: Posted by adamarling — June 19th, 2011, 5:14 pm


]]>
2011-06-17T17:36:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=21047#p21047 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
Code:
add_filter("ws_plugin__s2member_preserve_paid_registration_times""__return_true");
  

Statistics: Posted by Cristián Lávaque — June 17th, 2011, 5:36 pm


]]>
2011-06-17T11:49:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=21022#p21022 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
Wow, fantastic. I've never used Hooks or Filters before in my current project. How do I apply a filter ws_plugin__s2member_preserve_paid_registration_times ?

I tried placing the following line of code in /wp-content/mu-plugins/s2-hacks.php , however Last Payment Time variable was still erased.

apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ());

Is there additional code I will need from the link you sent above? Or is there a different directory I should be placing this filter in?

thanks again.
- Adam

Statistics: Posted by adamarling — June 17th, 2011, 11:49 am


]]>
2011-06-16T16:40:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=20959#p20959 <![CDATA[Re: EOT Value Remains Post-Expiration?]]> ws_plugin__s2member_preserve_paid_registration_times. viewtopic.php?f=40&t=9557&src_doc_v=110605#src_doc_line_158

About the EOT, that's deleted and I didn't find a hook to prevent it, but s2Member makes a note with time of this, which you may be able to use. viewtopic.php?f=40&t=9557&src_doc_v=110605#src_doc_line_169

Code:
$s2_notes = get_user_option('s2member_notes', $user_id); 


I hope that helps.

Statistics: Posted by Cristián Lávaque — June 16th, 2011, 4:40 pm


]]>
2011-06-16T13:23:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=20942#p20942 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
Thanks again for your attention on this posting...

I put together an EOT script which attempts to write a Member's Last Payment Time & EOT to a new table I created, when s2members's Automatic EOT function demotes a member on their Expiration Date. However s2member's script demotes a Member (and erases the data I need) before I can pull the Last Payment Time ( s2member_last_payment_time ) variable and EOT Automatic variable ( s2member_auto_eot_time ) from the database. Note my attempted script below:

Code:
<?
$wp_user_id = $_GET["wp_user_id"];
$eot_del_type = $_GET["eot_del_type"];

$user_data = get_userdata($user_id);

if (get_user_option("s2member_auto_eot_time", $user_id) == NULL) { $eot = '';}
else { $eot = date("Y-m-d", get_user_option("s2member_auto_eot_time", $user_id)); }

if (get_user_option("s2member_last_payment_time", $user_id) == NULL) { $lpd = '';}
else { $lpd = date("Y-m-d", get_user_option("s2member_last_payment_time", $user_id)); }

// insert Member's previous Last Payment Time & EOT values so I can access them post-demotion
$insertEOT = mysql_query("INSERT INTO expirations (id, wp_user_id, eot, lpd, eot_del_type) VALUES ('', $wp_user_id, '$eot', '$lpd', '$eot_del_type')") or die('Query failed: ' . mysql_error());               
       
?>


So my questions now would be:
1.) Are there any other s2member custom variable(s) which may hold these values post-demotion?
2.) Is there a way to call an EOT Automatic Notice script prior to the actual demotion? Like pre 1 day or pre 10 minutes or something?

Basically I'm trying to avoid storing Last Payment Time and EOT Automatic time in 2 separate database tables, so as to avoid confusion. It'd be awesome (for me at least) if EOT and Last Payment Time values existed forever until the same Member decided to pay for a subscription again.

I suppose I could write a script which would update a table I've created with Last Payment Date value when a Member pays (via the Notification script). And then update (in this same created table) an EOT value when the Member's term expires via the script I noted above. But just seems to me I'd be potentially storing the same data in 2 separate locations, which seems like could cause problems/confusion down the road.

Anyhow, if you have the time and see something that I'm just missing in s2Member's processing in a scenario like this, as always much appreciated.

thanks,
Adam

Statistics: Posted by adamarling — June 16th, 2011, 1:23 pm


]]>
2011-06-14T00:56:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=20664#p20664 <![CDATA[Re: EOT Value Remains Post-Expiration?]]>
No, this is not logged by s2Member, but you could keep you own log using the EOT/Deletion Notification and a custom script to save the data. WP Admin -> s2Member -> API / Notifications -> EOT/Deletion Notification

I hope that helps.

Statistics: Posted by Cristián Lávaque — June 14th, 2011, 12:56 am


]]>
2011-06-10T16:52:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=20544#p20544 <![CDATA[Also Last Payment Date affected]]> Statistics: Posted by adamarling — June 10th, 2011, 4:52 pm


]]>
2011-06-10T16:45:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10113&p=20543#p20543 <![CDATA[EOT Value Remains Post-Expiration?]]>
I was wondering if there's any hack to trick to maintaining the EOT timestamp value associated with an s2Membership, once a Member's Membership has expired? Reason being, I have a need to run reports which pull 30-day, 60-day, etc....post expiration reports, and currently I'm having to create a decent amount of code to parse the Member Notes field in order to get the previous EOT date from the "Demoted on:..." line within a Member's Notes.

I've checked the EOT Behavior options, so maybe there is a hack?

thanks,
Adam

Statistics: Posted by adamarling — June 10th, 2011, 4:45 pm


]]>