OK, private message box enabled again.
And also point out the problem page URL and form URL, where I can edit your custom PHP codes
My issue is resolved now. Thank you!
I was able to figure out how to make it work based on your initial suggestions.
I found this script which pretty well summed up what you were saying
hidden link
I decided not to incorporate the toolset event notification because when a users updates their profile contact date it would be in the next year or more. So I just need something that checks for any upcoming renewals once a day.
For the query part of the above script I used this.
function db_renewal() {
//
$before_date = date( "U", strtotime( "+14days" ) ); // I need to find a better way to check this.
$before_date_plus1 = date( "U", strtotime( "+15days" ) );
global $wpdb;
$results = $wpdb->get_results( "
SELECT user_id, meta_value as 'wpcf-contract-end-date'. // Toolset custom field
FROM $wpdb->usermeta
WHERE `meta_key` = 'wpcf-contract-end-date' AND `meta_value` > $before_date AND `meta_value` < $before_date_plus1" ); // Need to find a better way to compare
foreach ($results as $results) { // Sends an email for each result.
wp_mail( get_option( 'admin_email' ), $subject, $body ); // Still working on how to send to each user
}
}
add_action( 'db_renewal', 'db_renewal' );