function pmprosd_pmpro_profile_start_date($start_date, $order) { $subscription_delay = null; //if a discount code is used, we default to the setting there if (!empty($order->discount_code)) { global $wpdb; //get code id $code_id = $wpdb->get_var("SELECT id FROM {$wpdb->pmpro_discount_codes} WHERE code = '" . esc_sql($order->discount_code) . "' LIMIT 1"); if (!empty($code_id)) { //we have a code $delays = pmpro_getDCSDs($code_id); if (!empty($delays[$order->membership_id])) { if (!is_numeric($delays[$order->membership_id])) { $subscription_delay = pmprosd_daysUntilDate($delays[$order->membership_id]); } else { $subscription_delay = $delays[$order->membership_id]; } //we have a delay for this level, set the start date to X days out $start_date = date("Y-m-d", strtotime("+ " . intval($subscription_delay) . " Days", current_time('timestamp'))) . "T0:0:0"; } } } else { //check the level for a subscription delay $subscription_delay = get_option("pmpro_subscription_delay_" . $order->membership_id, ""); if (!is_numeric($subscription_delay)) { $subscription_delay = pmprosd_daysUntilDate($subscription_delay); } if (!empty($subscription_delay)) { $start_date = date("Y-m-d", strtotime("+ " . intval($subscription_delay) . " Days", current_time('timestamp'))) . "T0:0:0"; } } $start_date = apply_filters('pmprosd_modify_start_date', $start_date, $order, $subscription_delay); return $start_date; }
function pmprosd_level_cost_text($cost, $level) { if (!empty($level->code_id)) { $all_delays = pmpro_getDCSDs($level->code_id); if (!empty($all_delays) && !empty($all_delays[$level->id])) { $subscription_delay = $all_delays[$level->id]; } } else { $subscription_delay = get_option("pmpro_subscription_delay_" . $level->id, ""); } $find = array("Year.", "Month.", "Week.", "Year</strong>.", "Month</strong>.", "Week</strong>.", "Years.", "Months.", "Weeks.", "Years</strong>.", "Months</strong>.", "Weeks</strong>.", "payments.", "payments</strong>."); $replace = array("Year", "Month", "Week", "Year</strong>", "Month</strong>", "Week</strong>", "Years", "Months", "Weeks", "Years</strong>", "Months</strong>", "Weeks</strong>", "payments", "payments</strong>"); if (!empty($subscription_delay) && is_numeric($subscription_delay)) { $cost = str_replace($find, $replace, $cost); $cost .= " after your <strong>" . $subscription_delay . " day trial</strong>."; } elseif (!empty($subscription_delay)) { $cost = str_replace($find, $replace, $cost); $cost .= " starting " . date_i18n(get_option("date_format"), strtotime(pmprosd_daysUntilDate($subscription_delay) + 1 . "Days", current_time("timestamp"))) . "."; } return $cost; }