本文整理汇总了PHP中PMProEmail::sendTrialEndingEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PMProEmail::sendTrialEndingEmail方法的具体用法?PHP PMProEmail::sendTrialEndingEmail怎么用?PHP PMProEmail::sendTrialEndingEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMProEmail
的用法示例。
在下文中一共展示了PMProEmail::sendTrialEndingEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pmpro_cron_trial_ending_warnings
function pmpro_cron_trial_ending_warnings()
{
global $wpdb;
//make sure we only run once a day
$today = date("Y-m-d 00:00:00");
$pmpro_email_days_before_trial_end = apply_filters("pmpro_email_days_before_trial_end", 7);
//look for memberships with trials ending soon (but we haven't emailed them within a week)
$sqlQuery = "\n\t\tSELECT \n\t\t\tmu.user_id, mu.membership_id, mu.startdate, mu.cycle_period, mu.trial_limit FROM {$wpdb->pmpro_memberships_users} mu LEFT JOIN {$wpdb->usermeta} um ON um.user_id = mu.user_id AND um.meta_key = 'pmpro_trial_ending_notice' \n\t\tWHERE \n\t\t\tmu.status = 'active' AND mu.trial_limit IS NOT NULL AND mu.trial_limit > 0 AND\n\t\t\t(\n\t\t\t\t(cycle_period = 'Day' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Day) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) OR\n\t\t\t\t(cycle_period = 'Week' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Week) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) OR\n\t\t\t\t(cycle_period = 'Month' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Month) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) OR\n\t\t\t\t(cycle_period = 'Year' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Year) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) \n\t\t\t)\t\t\n\t\t\t\t\t\t\n\t\t\tAND (um.meta_value IS NULL OR um.meta_value = '' OR DATE_ADD(um.meta_value, INTERVAL " . $pmpro_email_days_before_trial_end . " Day) <= '" . $today . "') \n\t\tORDER BY mu.startdate";
$trial_ending_soon = $wpdb->get_results($sqlQuery);
foreach ($trial_ending_soon as $e) {
$send_email = apply_filters("pmpro_send_trial_ending_email", true, $e->user_id);
if ($send_email) {
//send an email
$pmproemail = new PMProEmail();
$euser = get_userdata($e->user_id);
$pmproemail->sendTrialEndingEmail($euser);
printf(__("Trial ending email sent to %s. ", "pmpro"), $euser->user_email);
}
//update user meta so we don't email them again
update_user_meta($euser->ID, "pmpro_trial_ending_notice", $today);
}
}