當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMProEmail::sendTrialEndingEmail方法代碼示例

本文整理匯總了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);
    }
}
開發者ID:Willislahav,項目名稱:paid-memberships-pro,代碼行數:22,代碼來源:crons.php


注:本文中的PMProEmail::sendTrialEndingEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。