本文整理汇总了PHP中PMProEmail::sendMembershipExpiredEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP PMProEmail::sendMembershipExpiredEmail方法的具体用法?PHP PMProEmail::sendMembershipExpiredEmail怎么用?PHP PMProEmail::sendMembershipExpiredEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMProEmail
的用法示例。
在下文中一共展示了PMProEmail::sendMembershipExpiredEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pmpro_cron_expire_memberships
function pmpro_cron_expire_memberships()
{
global $wpdb;
//make sure we only run once a day
$today = date("Y-m-d", current_time("timestamp"));
//look for memberships that expired before today
$sqlQuery = "SELECT mu.user_id, mu.membership_id, mu.startdate, mu.enddate FROM {$wpdb->pmpro_memberships_users} mu WHERE mu.status = 'active' AND mu.enddate IS NOT NULL AND mu.enddate <> '' AND mu.enddate <> '0000-00-00 00:00:00' AND DATE(mu.enddate) <= '" . $today . "' ORDER BY mu.enddate";
if (defined('PMPRO_CRON_LIMIT')) {
$sqlQuery .= " LIMIT " . PMPRO_CRON_LIMIT;
}
$expired = $wpdb->get_results($sqlQuery);
foreach ($expired as $e) {
do_action("pmpro_membership_pre_membership_expiry", $e->user_id, $e->membership_id);
//remove their membership
pmpro_changeMembershipLevel(false, $e->user_id, 'expired');
do_action("pmpro_membership_post_membership_expiry", $e->user_id, $e->membership_id);
$send_email = apply_filters("pmpro_send_expiration_email", true, $e->user_id);
if ($send_email) {
//send an email
$pmproemail = new PMProEmail();
$euser = get_userdata($e->user_id);
$pmproemail->sendMembershipExpiredEmail($euser);
if (current_user_can('manage_options')) {
printf(__("Membership expired email sent to %s. ", "pmpro"), $euser->user_email);
} else {
echo ". ";
}
}
}
}
示例2: date
function pmpro_cron_expire_memberships()
{
global $wpdb;
//make sure we only run once a day
$today = date("Y-m-d");
//look for memberships that expired before today
$sqlQuery = "SELECT mu.user_id, mu.membership_id, mu.startdate, mu.enddate FROM $wpdb->pmpro_memberships_users mu WHERE mu.status = 'active' AND mu.enddate IS NOT NULL AND mu.enddate <> '' AND mu.enddate <> '0000-00-00 00:00:00' AND DATE(mu.enddate) <= '" . $today . "' ORDER BY mu.enddate";
$expired = $wpdb->get_results($sqlQuery);
foreach($expired as $e)
{
//remove their membership
pmpro_changeMembershipLevel(false, $e->user_id);
$send_email = apply_filters("pmpro_send_expiration_email", true, $e->user_id);
if($send_email)
{
//send an email
$pmproemail = new PMProEmail();
$euser = get_userdata($e->user_id);
$pmproemail->sendMembershipExpiredEmail($euser);
echo "Membership expired email sent to " . $euser->user_email . ". ";
}
}
}
示例3: pmpropbc_cancel_overdue_orders
function pmpropbc_cancel_overdue_orders()
{
global $wpdb;
//make sure we only run once a day
$now = current_time('timestamp');
$today = date("Y-m-d", $now);
//have to run for each level, so get levels
$levels = pmpro_getAllLevels(true, true);
if (empty($levels)) {
return;
}
foreach ($levels as $level) {
//get options
$options = pmpropbc_getOptions($level->id);
if (!empty($options['cancel_days'])) {
$date = date("Y-m-d", strtotime("+ " . $options['cancel_days'] . " days", $now));
} else {
$date = $today;
}
//need to get all combos of pay cycle and period
$sqlQuery = "SELECT DISTINCT(CONCAT(cycle_number, ' ', cycle_period)) FROM {$wpdb->pmpro_memberships_users} WHERE membership_id = '" . $level->id . "' AND cycle_number > 0 AND status = 'active'";
$combos = $wpdb->get_col($sqlQuery);
if (empty($combos)) {
continue;
}
foreach ($combos as $combo) {
//get all check orders still pending after X days
$sqlQuery = "\r\n\t\t\t\tSELECT id \r\n\t\t\t\tFROM {$wpdb->pmpro_membership_orders} \r\n\t\t\t\tWHERE membership_id = {$level->id} \r\n\t\t\t\t\tAND gateway = 'check' \r\n\t\t\t\t\tAND status = 'pending' \r\n\t\t\t\t\tAND DATE_ADD(timestamp, INTERVAL {$combo}) <= '" . $date . "'\r\n\t\t\t\t\tAND notes NOT LIKE '%Cancelled:%' AND notes NOT LIKE '%Cancellation Skipped:%'\r\n\t\t\t\tORDER BY id\r\n\t\t\t";
if (defined('PMPRO_CRON_LIMIT')) {
$sqlQuery .= " LIMIT " . PMPRO_CRON_LIMIT;
}
$orders = $wpdb->get_col($sqlQuery);
if (empty($orders)) {
continue;
}
foreach ($orders as $order_id) {
//get the order and user data
$order = new MemberOrder($order_id);
$user = get_userdata($order->user_id);
$user->membership_level = pmpro_getMembershipLevelForUser($order->user_id);
//if they are no longer a member, let's not send them an email
if (empty($user->membership_level) || empty($user->membership_level->ID) || $user->membership_level->id != $order->membership_id) {
//note when we send the reminder
$new_notes = $order->notes . "Cancellation Skipped:" . $today . "\n";
$wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET notes = '" . esc_sql($new_notes) . "' WHERE id = '" . $order_id . "' LIMIT 1");
continue;
}
//cancel the order and subscription
do_action("pmpro_membership_pre_membership_expiry", $order->user_id, $order->membership_id);
//remove their membership
pmpro_changeMembershipLevel(false, $order->user_id, 'expired');
do_action("pmpro_membership_post_membership_expiry", $order->user_id, $order->membership_id);
$send_email = apply_filters("pmpro_send_expiration_email", true, $order->user_id);
if ($send_email) {
//send an email
$pmproemail = new PMProEmail();
$euser = get_userdata($order->user_id);
$pmproemail->sendMembershipExpiredEmail($euser);
if (current_user_can('manage_options')) {
printf(__("Membership expired email sent to %s. ", "pmpro"), $euser->user_email);
} else {
echo ". ";
}
}
}
}
}
}