latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

EMail for Renewal of Membership

Home Forums Community Forum EMail for Renewal of Membership

This topic contains 6 replies, has 3 voices. Last updated by  chidu 4 years, 2 months ago.

Topic Author Topic
Posted: Friday Oct 19th, 2012 at 5:18 am #28971
chidu
Username: chidu

Hey team,

When we add a new member (who’s paid cash or other means of payment) I want to set an expiry date. So that they get a reminder to renew. But me unable to find that.

i want to send custom emails prior to the renewal period and if the payment didn’t go through would suspend there membership.

How to give a trail period for a month and after a trail period mail has to send informing a member for registration ?

How do I add someone and set it to keep them as a member 1 year ?

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Friday Oct 19th, 2012 at 8:00 am #28986
cassel
Username: cassel

In s2M, you have currently no way to send a reminder of any kind as it is not configured as a mailing list. However, there is a kind of way around it and that is what i have to do so far.

Integrate with MailChimp
Add a mergetag specific for your particular membership that will be a date
When a member pays, you enter the date manually in MC for that mergetag
Using the autoresponder in MC, you can send a reminder say 1 or 2 weeks ahead of time (or whatever is convenient for your particular membership) with a link to a hidden page with the “renewal” button
In your site, create a page that will not appear in the navigation and accessible only with a direct link (that will be provided in the email)
Use conditionals to make sure that the button to renew is only visible if the member is logged in and has the particular condition for the membership (either a level or a ccap). This means that only those who are currently registered can access that button, even if someone lands on that page by accident.

I know that the updating the date in MC manually is a PITA. It sure would be worse if you have lots of members and registrations and such. In my case, i have a manageable number of registrations. However, i am considering the development of custom coding for this.

Hope it helps, somewhat.

Posted: Saturday Oct 20th, 2012 at 8:07 am #29120

Hi Chidu.

Using MailChimp, as Cassel points out, would be a way. Another would would be using a cronjob with your own custom script to check the EOT (end of term) times with a database query, to email those that’ll expire soon.

One thing you have to understand about EOT times is that they’re not set with subscriptions before the subscription is ended in the payment gateway. So relying on the EOT time in the user’s profile to notify him ahead of time, doesn’t work very well with subscriptions that are still running.

One-time payments, though, if not for unlimited access, will set an EOT time at the time of the purchase.

One way to give a trial and have the EOT time for it set immediately, is to use the free registration pro-form, to give access to the protected content, but without charging. This pro-form lets you set the expiration for it, if you want to use it for trials.

I hope that helps. :)

Posted: Thursday Oct 25th, 2012 at 3:16 am #29612
chidu
Username: chidu

thanks it helped me

  • This reply was modified 4 years, 2 months ago by  chidu.
  • This reply was modified 4 years, 2 months ago by  chidu.
Posted: Friday Oct 26th, 2012 at 6:21 am #29738

Great. :)

Posted: Tuesday Nov 6th, 2012 at 2:55 am #30750
chidu
Username: chidu

Hi, i have written for the cron job but i am not sure this ll work for me

  • This reply was modified 4 years, 2 months ago by  chidu.
Posted: Tuesday Nov 6th, 2012 at 4:21 am #30754
chidu
Username: chidu

Hi Cristian,

I have written the code, can you pls check the code and tell me tat it’s work properly or not.

<?php
$conn = mysql_connect('localhost', 'root', '');
$database = mysql_select_db('datetime',$conn);
?>
<?php

date_default_timezone_set("UTC");

//Function to Calculate the time difference
function dateDiff($time1, $time2, $precision = 6) {
	// If not numeric then convert texts to unix timestamps
	if (!is_int($time1)) {
	  $time1 = strtotime($time1);
	}
	if (!is_int($time2)) {
	  $time2 = strtotime($time2);
	}
	
	// If time1 is bigger than time2
	// Then swap time1 and time2
	if ($time1 > $time2) {
	  $ttime = $time1;
	  $time1 = $time2;
	  $time2 = $ttime;
	}
	
	// Set up intervals and diffs arrays
	$intervals = array('year','month','day','hour','minute','second');
	$diffs = array();
	
	// Loop thru all intervals
	foreach ($intervals as $interval) {
	  // Set default diff to 0
	  $diffs[$interval] = 0;
	  // Create temp time from time1 and interval
	  $ttime = strtotime("+1 " . $interval, $time1);
	  // Loop until temp time is smaller than time2
	  while ($time2 >= $ttime) {
	$time1 = $ttime;
	$diffs[$interval]++;
	// Create new temp time from time1 and interval
	$ttime = strtotime("+1 " . $interval, $time1);
	  }
	}
	
	$count = 0;
	$times = array();
	// Loop thru all diffs
	foreach ($diffs as $interval => $value) {
	  // Break if we have needed precission
	  if ($count >= $precision) {
	break;
	  }
	  // Add value and interval 
	  // if value is bigger than 0
	  if ($value > 0) {
	// Add s if value is not 1
	if ($value != 1) {
	  $interval .= "s";
	}
	// Add value and interval to times array
	$times[] = $value . " " . $interval;
	$count++;
	  }
	}
	
	// Return string with times
	return implode(", ", $times);
}

//Function to Send mail
function sendmail($to, $remaindays){
	$tomail	 = $to;
	$from    = "abc@abc.com";	 
	$semi_rand = md5(time());
	$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
	
	//$headers  = "MIME-Version: 1.0\r\n";
	//$headers .= "Content-type: text/html; charset=UTF-8\r\n";	
	$mailSubject = "Bones of PA : Mail Regarding Renewal of the Membership";
	$headers = "From: $from";
	$headers .= "\nMIME-Version: 1.0\n" .
				  "Content-Type: multipart/mixed;\n" .
				  " boundary=\"{$mime_boundary}\"";			
		
	$message = "This mail is regarding to inform that your membership is going to be expired ".$remaindays.", so please renew the Membership soon ";
	$message = "This is a multi-part message in MIME format.\n\n" .
				 "--{$mime_boundary}\n" .
				 "Content-Type: text/html; charset=\"UTF-8\"\n" .
				 "Content-Transfer-Encoding: 7bit\n\n" .
				 $message . "\n\n";
	$ok = @mail($tomail, $mailSubject, $message, $headers);	

}
?>

<?php
$date1 = date( "Y-m-d", time() );
$date2 = "2018-10-23";

$sql = 'SELECT * FROM mem_users';
$qury = mysql_query($sql);

while($row = mysql_fetch_array($qury)){
	$mailid = $row['user_email'];
	$date_time = $row['user_registered'];
	$date = split(' ', $date_time);//echo $date[0]."<br>";
	$date2 = $date[0];

	$day = dateDiff($date2, $date1);
	$noofdays = explode(", ", $day);
	//print_r($noofdays);
	$years = $noofdays[0];
	$months = $noofdays[1];
	$days = $noofdays[2];
	
	if($months == 11 && $days == 0){
		sendmail($mailid, $remainindays = "in a month");
		//echo "<br>One month remaining for the Renew";
	}
	if($months == 11 && $days == 28){
		sendmail($mailid, $remainindays = "in two days");
		//echo "<br>Two Days remaining for the Renew";
	}
	//printf("<br />%d years, %d months, %d days\n", $years, $months, $days);
}
?>

I have checked this link but i was unable to know tat where to use this code in plugin

http://www.s2member.com/forums/topic/automatic-renewal-reminder/

Thanks in advance

  • This reply was modified 4 years, 2 months ago by  chidu.
Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.