I have Participant Database plugin for wordpress.
Is there any script I can add for the administrator to be notified the day before a participant’s due date?
For example: due date for John Pop is 25/03/2020. I want a automatically email sent to website admin on 24/03/2020 to notify about this event.
I have this script from developer, but this is for a record, when it`s updated. Can we modify this script for my request, please?
THIS IS MY DATABASE FIELD ABOUT DUE DATE https://imgur.com/EpkEvkU
<?php
/*
Plugin Name: Participants Database Update Notify
Description: Notifies the user when their record is updated
*/
/*
* before the update is stored, send an email notification to the participant
*/
add_filter( 'pdb-before_submit_update', 'pdb_send_record_update_notification' );
/**
* sends an email notification when a record is updated
*
* @param array $post the submitted record data
* @return array the new record data
*/
function pdb_send_record_update_notification( $post )
{
if ( ! is_admin() || empty( $post['email'] ) ) {
/*
* if we're not in the admin or if there is no email address to send to, do
* nothing and return
*/
return $post;
}
/*
* these three variables will need to be edited for your application
*/
$subject = 'Your record has been updated';
$message = 'Dear [first_name] [last_name],
Your record has been updated.';
$from = 'Your Website <info@yourwebsite.com>';
/*
* put it all together into the configuration array
*/
$config = array(
'to' => $post['email'],
'from' => $from,
'subject' => $subject,
'template' => $message,
);
// send the email
PDb_Template_Email::send( $config, $post );
/*
* return the record data so it can be saved
*/
return $post;
}
Thanks.