I went off of Bill’s EOT Notification post (http://www.s2member.com/forums/topic/setting-up-eot-notifications/)
But im noob when it comes to PHP and could use some assistance setting it up.
I created the /wp-content/mu-plugins directory with the s2hack_eot_notify.php file.
and in this s2hack_eot_notify.php file i have the following code..
ID, $wpdb->prefix.'s2member_auto_eot_time', true)) && !($neot = get_user_meta($current_user->ID, 's2_eot_notify_date', true))):
$neot = $eot - $time_to_sub;
/**/
if($neot > time()) # If the Notification EOT time is in the future
add_user_meta($current_user->ID, 's2_eot_notify_date', $neot); # Add the Notification EOT time
endif;
if(!wp_next_scheduled('s2hack_eot_notify') && $GLOBALS['WS_PLUGIN__']['s2member']['o']['auto_eot_system_enabled'])
wp_schedule_event(current_time('timestamp'), 'daily', 's2hack_eot_notify');
}
if(has_action('s2hack_eot_notify')) # Add action only if it exists
add_action('s2hack_eot_notify', 's2hack_eot_notification');
function s2hack_eot_notification() # Function to be called daily
{
$n_eot = time();
/**/
if(is_array($eots = $wpdb->get_results("SELECT `user_id` AS `ID` FROM `".$wpdb->usermeta."` WHERE `meta_key` = 's2_eot_notify_date' AND `meta_value` != '' AND `meta_value` escape($n_eot)."' LIMIT 3"))):
foreach($eots as $eot): # We need to loop through all of the IDs to send the data
if(($user_id = $eot->ID) && is_object($user = new WP_User($user_id)) && $user->ID && !$user->has_cap('administrator')): # Set up variables
delete_user_meta($user_id, 's2_eot_notify_date');
$to = $user_email;
$subject = 'Notification of membership renewal!';
$message = "Dear, $user_id. nn Your membership with Suzuki Music Los Angeles is due for renewal. n Please login at suzukimusiclosangeles.com and submit your payment to extend your membership. nn Thank you! n Suzuki Music Los Angeles";
$headers = 'From: SMAC-LA ' . "rn";
function wp_mail( $to, $subject, $message, $headers ){};
endif;
endforeach;
endif;
}
?>
Will this work or did I do anything wrong or should I fix/change something?
Could use a PHP experts advice here..