I'm setting up some transactionals emails on my site and I'd like to send one 3 days after a user signed up if he didn't post. Here is what I have:
function set_mail_html_content_type() {
return 'text/html';
}
add_action( 'user_help_signup', 10 ,2 );
function user_help_signup( $ID, //DURATION SINCE SIGN UP ) {
if ( //DURATION SINCE SIGN UP > 3days || count_user_posts( $post->post_author ) > 1 )
return;
$to = get_user_by( 'id', $post->post_author )->user_email;
$subject = 'Need help ?';
$headers = array('Content-Type: text/html');
$message = '<h3>Hi {display_name}! </h3> <p>
You signed up 3 days ago on mysite.com and we wanted to know if we could help you to get started ';
wp_mail( $to, $subject, $message, 'Content-Type: text/html' );
}
However, I can't find any info on how to retrieve the duration since sign up. How can I achieve this?
$user->user_registered
which you would then compare to the current date to get the difference.