function record_active_payment($sub_id, $level_order, $stamp) { $rel = $this->get_relationship($sub_id); if ($rel) { $subscription = new M_Subscription($sub_id); $level = $subscription->get_level_at_position($level_order); if ($level) { $payment = array('member_id' => $this->ID, 'sub_id' => $sub_id, 'level_id' => $level->id, 'level_order' => $level_order, 'paymentmade' => gmdate('Y-m-d H:i:s', $stamp)); $expires = mysql2date("U", $rel->expirydate); switch ($level->level_period_unit) { case 'd': $paymentexpires = strtotime('+' . $level->level_period . ' days', $expires); break; case 'w': $paymentexpires = strtotime('+' . $level->level_period . ' weeks', $expires); break; case 'm': $paymentexpires = strtotime('+' . $level->level_period . ' months', $expires); break; case 'y': $paymentexpires = strtotime('+' . $level->level_period . ' years', $expires); break; } $payment['paymentexpires'] = gmdate('Y-m-d H:i:s', $paymentexpires); $this->db->insert($this->member_payments, $payment); } } }
<tr> <td class='detailscolumn'> <?php echo $sub->sub_name(); ?> </td> <td class='pricecolumn'> <?php $amount = $sub->sub_pricetext(); if (!empty($amount)) { echo $amount; if (isset($sub->coupon_label) && !empty($sub->coupon_label)) { echo sprintf('<p class="membership_coupon_label">%s</p>', $sub->coupon_label); } } else { $first = $sub->get_level_at_position(1); if (!empty($first)) { $price = $first->level_price; if ($price == 0) { $price = "Free"; } else { $M_options = get_option('membership_options', array()); switch ($M_options['paymentcurrency']) { case "USD": $price = "\$" . $price; break; case "GBP": $price = "£" . $price; break; case "EUR": $price = "€" . $price;
function do_subscriptionprice_shortcode($atts, $content = null, $code = "") { global $wp_query; $defaults = array("holder" => '', "holderclass" => '', "item" => '', "itemclass" => '', "postfix" => '', "prefix" => '', "wrapwith" => '', "wrapwithclass" => '', "subscription" => '', "level" => 1); extract(shortcode_atts($defaults, $atts)); $level = (int) $level; if (empty($subscription)) { return ''; } $html = ''; if (!empty($holder)) { $html .= "<{$holder} class='{$holderclass}'>"; } if (!empty($item)) { $html .= "<{$item} class='{$itemclass}'>"; } $html .= $prefix; // The title if (!empty($wrapwith)) { $html .= "<{$wrapwith} class='{$wrapwithclass}'>"; } $sub = new M_Subscription((int) $subscription); $first = $sub->get_level_at_position($level); if (!empty($first)) { $price = $first->level_price; if ($price == 0) { $price = "Free"; } else { $M_options = get_option('membership_options', array()); switch ($M_options['paymentcurrency']) { case "USD": $price = "\$" . $price; break; case "GBP": $price = "£" . $price; break; case "EUR": $price = "€" . $price; break; default: $price = apply_filters('membership_currency_symbol_' . $M_options['paymentcurrency'], $M_options['paymentcurrency']) . $price; } } } $html .= $price; if (!empty($wrapwith)) { $html .= "</{$wrapwith}>"; } $html .= $postfix; if (!empty($item)) { $html .= "</{$item}>"; } if (!empty($holder)) { $html .= "</{$holder}>"; } return $html; }