?> </a> <?php } ?> </td> <td class="memberid"><?php echo $retrieved_data->member_id; ?> </td> <td class="joining date"><?php echo $retrieved_data->begin_date; ?> </td> <td class="joining date"><?php echo gmgt_check_membership($retrieved_data->ID); ?> </td> <!--<td class="class"><?php $classdata = $obj_class->get_single_class($retrieved_data->class_id); echo $classdata->class_name; ?> </td>--> <td class="status"><?php echo $retrieved_data->membership_status; ?> </td> <!--<td class="email"><?php echo $retrieved_data->user_email; ?> </td>
function gmgt_send_alert_message() { $enable_service = get_option('gym_enable_membership_alert_message'); if ($enable_service == 'yes') { $search = array('[GMGT_MEMBERNAME]', '[GMGT_STARTDATE]', '[GMGT_ENDDATE]', '[GMGT_MEMBERSHIP]'); $before_days = get_option('gmgt_reminder_before_days'); $today = date('Y-m-d'); $get_members = array('role' => 'member'); $membersdata = get_users($get_members); if (!empty($membersdata)) { foreach ($membersdata as $retrieved_data) { $expiredate = gmgt_check_membership($retrieved_data->ID); $start_date = $retrieved_data->begin_date; $membership_id = get_user_meta($retrieved_data->ID, 'membership_id', true); $membership_name = get_membership_name($membership_id); $message_content = get_option('gym_reminder_message'); $replace = array($retrieved_data->display_name, $retrieved_data->begin_date, $expiredate, $membership_name); $message_content = str_replace($search, $replace, $message_content); $mail_sent = check_alert_mail_send($retrieved_data->ID, $expiredate, $start_date); $date1 = date_create($today); $date2 = date_create($expiredate); $interval = $date1->diff($date2); $difference = $interval->format('%R%a'); if ($difference <= +$before_days && $difference > 0) { if ($mail_sent == 0) { $to = $retrieved_data->user_email; $subject = "Gym Membership Alert"; $from = get_option('admin_email'); $headers = 'From: <' . $from . '>' . "\r\n"; $success = wp_mail($to, $subject, $message_content, $headers); if ($success) { insert_alert_mail($retrieved_data->ID, $expiredate, $start_date, $membership_id); } } } } } } }