Trouble with EOT Renewal Reminder Emails in PayPal options

Hello and thanks for any help on this,

I have a pretty serious problem with EOT reminders, resulting in a large loss of member renewals.

S2 Version 170722 + s2Member Pro v170722 | WP: 4.8.2

Here are the details:

  • I have 8 different EOT reminders set : -30,-14,-7,3,7,30,60,76

  • I am using WP Mail Log to track which emails go out

  • I added additional admin emails to be notified starting at 3 (see attached image)

  • None of the after-expiration emails are going out: 3,7,30,60,76

  • Some before-expiration emails are going out: -30,-14,-7. (see 2nd attached image)

  • However… many of the (-30,-14,-7) emails are not going out, for example I see a user that expired one day ago who did not get any of those emails.

Some other factors that may contribute: I have disabled WPcron in WPconfig and run a manual cron every 30 minutes to wp-cron.php. We also use a heartbeat control plugin.

I’m having difficulty troubleshooting this because it is so inconsistent.

Any thoughts and help would be appreciated.

EOT Reminder Emails:

WP MAIL LOG:

Somewhere in there is where your problem lies. The inconsistency in the sending of emails is the big clue. I would start by getting rid of the heartbeat control. That is a really bad idea as a matter of principle anyway.

Okay, thanks. Heartbeat Control is gone. Our host (Siteground) recommended it.

However it is completely consistent in not sending any of the positive EOT reminders.

The way you troubleshoot something is to take it back to the environment that the problematic thing expects. s2Member is expecting a viable cron. Heartbeat control interferes with that, therefore you remove it. If that doesn’t solve the issue, then you revert to using WP cron. Then you’d test for plugin or theme conflicts, etc. That’s how troubleshooting works: there’s no magic bullet, just methodical testing.

But heartbeat control only really makes sense for the host, because it puts less load on their servers. If you have well-coded plugins that need the heartbeat, then installing heartbeat control will prevent them from functioning properly. And if you needed heartbeat control to deal with badly-coded plugins, then you’d be attempting to solve the wrong problem.

Thanks, I’ll go down the list.

All of the API notifications (EOT/Deletion and Payments) are going out. But even when the API notification goes out to the admin for a user the reminder email does not.

Are these Buy Now or Subscription memberships?

It is Buy Now, each term is 1 year and they have to complete some membership tasks to qualify to renew.

Have you also returned to using WP cron, deactivated all other plugins, and switched to a default theme?

I just found a setting in S2 for: Enable S2Member’s Auto-EOT system?

_If you’d like to run s2Member’s Auto-EOT System through a more traditional Cron Job; instead of through WP-Cron, you will need to configure a Cron Job through your server control panel; provided by your hosting company. Set the Cron Job to run once about every 10 minutes to an hour. You’ll want to configure an HTTP Cron Job that loads this https://aametinternational.org/?s2member_auto_eot_system_via_cron=1

When I browsed manually to that link it triggered a reminder email… though not the one for the user I was testing. So I’m going to try setting a cron for that.

I have re-enabled the regular WP cron. However it still looks like only some of the pre-EOT reminders are going out and none of the post EOT reminders go out.

I am using the settings in PayPal options, but wonder what if the user did not sign up with PayPal, if they were added manually?

Do they have an EOT?

Yes, every member has an EOT. (EDIT: Not all users have an EOT, if they have expired, they no longer have an EOT)

I just setup a copy of the site with S2member only and default theme to test with -3,-2,-1,0,1,2,3 EOT notifications.

I created 5 users with different EOT’s and after creation it did mail out the reminders. However, I can not figure out how to trigger another set of reminders to go out. For example, changing the EOT time or date or the member level (manually) did not trigger another set of EOT reminders. I am visiting the demo site to make sure that wp-cron gets activated as well as using the url …/?s2member_auto_eot_system_via_cron=1.

So this leads to another question, what exactly triggers the EOT reminder emails?

… and even on a clean install how can it be tested with 2000 members?

Testing update (s2member, WP Email Log and default theme only)

I delete the 5 test users and re-import them, each has a different EOT time set to trigger each of the 5 EOT reminders. I trigger the cron and all 5 reminders get sent.

I re-enable all plugins and the theme, repeat above and all the reminders also get sent, same result.

…all the emails are logged and everything looks good. But there still must be some difference that is happening in the live site.

UPDATE: Oct 8

Digging through S2 code to better understand how reminders are generated I found some clues in reminders.inc.php

  $user_ids_to_exclude = '
                SELECT DISTINCT `user_id` AS `ID` FROM `'.$wpdb->usermeta.'`
                    WHERE
                        (`meta_key` = \''.$wpdb->prefix.'s2member_last_reminder_scan\' AND `meta_value` >= \''.esc_sql($scan_time).'\')
                        OR (`meta_key` = \''.$wpdb->prefix.'s2member_reminders_enable\' AND `meta_value` = \'0\')
            ' ; 

  $scan_time            = apply_filters('ws_plugin__s2member_pro_eot_reminders_scan_time', strtotime('-1 day', self::$now), get_defined_vars());

The meta key, wpqa_s2member_last_reminder_scan, looks like it is supposed to get set with the scan time value and then be re-scanned each 24 hours (-1 day). When I look through the database I see 100’s of users who have a last scan time from last year. So clearly they are not being re-scanned and so no emails are being generated.

I’m now curious now why they wouldn’t be scanned? I’m going to guess that the ones that have been scanned recently are the ones that have received notifications.

I believe I have now resolved this issue.
There were no plugin or theme conflicts. It had everything to do with not scanning enough users per process.

From reminders.inc.php at line 84:
$per_process = apply_filters('ws_plugin__s2member_pro_eot_reminders_per_process', $vars['per_process'], get_defined_vars());

When I echoed out $per_process it reported only 6 per process. I’m assuming this means that every time the cron job is fired; it doesn’t continually loop through all users until they have all been checked. As we acquired new members the old ones were ‘pushed’ out of the group that was being processed every day - about 500-600 users. So only that group was being checked for EOT Reminders. Finding members in the database with a last_reminder_scan set from over a year ago was part of the clue.

I used the filter ws_plugin__s2member_pro_eot_reminders_per_process to increase the number incrementally until in a day it would process every member. This was about 45 per process for our member base, I then set it higher to account for future growth.