function handle_coupons_panel()
        {
            global $action, $page, $M_options;
            wp_reset_vars(array('action', 'page'));
            switch (addslashes($action)) {
                case 'edit':
                    if (isset($_GET['coupon_id'])) {
                        $this->handle_coupon_edit_form((int) $_GET['coupon_id']);
                    } else {
                        $this->handle_coupon_edit_form();
                    }
                    return;
                    // so we don't show the list below
                    break;
            }
            $messages = array();
            $messages[1] = __('Coupon added.', 'membership');
            $messages[2] = __('Coupon not added.', 'membership');
            $messages[3] = __('Coupon updated.', 'membership');
            $messages[4] = __('Coupon not updated.', 'membership');
            $messages[5] = __('Coupon deleted.', 'membership');
            $messages[6] = __('Coupon not deleted.', 'membership');
            $messages[7] = __('Coupons deleted.', 'membership');
            ?>
			<div class='wrap'>
				<div class="icon32" id="icon-link-manager"><br></div>
				<h2><?php 
            _e('Edit Coupons', 'membership');
            ?>
<a class="add-new-h2" href="admin.php?page=<?php 
            echo $page;
            ?>
&amp;action=edit&amp;coupon="><?php 
            _e('Add New', 'membership');
            ?>
</a></h2>

				<?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            if ($this->show_user_help($page)) {
                ?>
					<div class='screenhelpheader'>
						<a href="admin.php?page=<?php 
                echo $page;
                ?>
&amp;action=removeheader" class="welcome-panel-close"><?php 
                _e('Dismiss', 'membership');
                ?>
</a>
						<?php 
                ob_start();
                include_once membership_dir('membershipincludes/help/header.coupons.php');
                echo ob_get_clean();
                ?>
					</div>
					<?php 
            }
            $coupons = $this->get_coupons();
            $posts_columns = array('code' => __('Coupon Code', 'membership'), 'discount' => __('Discount', 'membership'), 'start' => __('Start Date', 'membership'), 'end' => __('Expire Date', 'membership'), 'sub' => __('Subscription', 'membership'), 'used' => __('Used', 'membership'), 'remaining' => __('Remaining Uses', 'membership'));
            ?>

				<form method="get" action="?page=<?php 
            echo esc_attr($page);
            ?>
">
					<input type="hidden" name="page" value="<?php 
            echo esc_attr($page);
            ?>
" />
					<?php 
            wp_nonce_field('bulk-coupon-actions');
            ?>
					<div class="tablenav">
						<div class="alignleft actions">
							<select name="action">
								<option selected="selected" value=""><?php 
            _e('Bulk Actions', 'membership');
            ?>
</option>
								<option value="bulk-delete"><?php 
            _e('Delete Coupon', 'membership');
            ?>
</option>
							</select>
							<input type="submit" class="button-secondary action" id="doaction" name="doaction" value="<?php 
            _e('Apply', 'membership');
            ?>
">
						</div>
					</div>
					<table width="100%" cellpadding="3" cellspacing="3" class="widefat fixed">
						<thead>
							<tr>
							<th scope="col" class="check-column"><input type="checkbox" /></th>
							<?php 
            foreach ($posts_columns as $column_id => $column_display_name) {
                $col_url = $column_display_name;
                ?>
								<th scope="col"><?php 
                echo $col_url;
                ?>
</th>
							<?php 
            }
            ?>
							</tr>
						</thead>
						<tfoot>
							<tr>
							<th scope="col" class="check-column"><input type="checkbox" /></th>
							<?php 
            foreach ($posts_columns as $column_id => $column_display_name) {
                $col_url = $column_display_name;
                ?>
								<th scope="col"><?php 
                echo $col_url;
                ?>
</th>
							<?php 
            }
            ?>
							</tr>
						</tfoot>
						<tbody id="the-list">
						<?php 
            if (!empty($coupons)) {
                $bgcolor = isset($class) ? $class : '';
                foreach ($coupons as $key => $coupon) {
                    $class = isset($class) && 'alternate' == $class ? '' : 'alternate';
                    //assign classes based on coupon availability
                    //$class = ($this->check_coupon($coupon_code)) ? $class . ' coupon-active' : $class . ' coupon-inactive';
                    echo '<tr class="' . $class . ' blog-row" style="vertical-align: top;"><th scope="row" class="check-column" valign="top"><input type="checkbox" name="coupons_checks[]"" value="' . $coupon->id . '" /></th>';
                    foreach ($posts_columns as $column_name => $column_display_name) {
                        switch ($column_name) {
                            case 'code':
                                ?>
											<td scope="row">
												<?php 
                                echo $coupon->couponcode;
                                $actions = array();
                                //$actions['id'] = "<strong>" . __('ID : ', 'membership') . $level->id . "</strong>";
                                $actions['edit'] = "<span class='edit'><a href='?page=" . $page . "&amp;action=edit&amp;coupon_id=" . $coupon->id . "'>" . __('Edit', 'membership') . "</a></span>";
                                $actions['delete'] = "<span class='delete'><a href='" . wp_nonce_url("?page=" . $page . "&amp;action=delete&amp;coupon_id=" . $coupon->id . "", 'delete-coupon_' . $coupon->id) . "'>" . __('Delete', 'membership') . "</a></span>";
                                ?>
												<br><div class="row-actions"><?php 
                                echo implode(" | ", $actions);
                                ?>
</div>
											</td>
										<?php 
                                break;
                            case 'discount':
                                ?>
											<td scope="row">
												<?php 
                                if ($coupon->discount_type == 'pct') {
                                    echo $coupon->discount . '%';
                                } else {
                                    if ($coupon->discount_type == 'amt') {
                                        echo $coupon->discount_currency . ' ' . number_format_i18n($coupon->discount, 2);
                                    }
                                }
                                ?>
											</td>
										<?php 
                                break;
                            case 'start':
                                ?>
											<td scope="row">
			                  				<?php 
                                echo mysql2date(get_option('date_format'), $coupon->coupon_startdate);
                                ?>
											</td>
										<?php 
                                break;
                            case 'end':
                                ?>
											<td scope="row">
												<?php 
                                if (!empty($coupon->coupon_enddate)) {
                                    echo mysql2date(get_option('date_format'), $coupon->coupon_enddate);
                                } else {
                                    _e('No End', 'membership');
                                }
                                ?>
											</td>
										<?php 
                                break;
                            case 'sub':
                                ?>
											<td scope="row">
												<?php 
                                if ($coupon->coupon_sub_id != 0) {
                                    $sub = new M_Subscription($coupon->coupon_sub_id);
                                    echo $sub->sub_name();
                                } else {
                                    _e('Any Subscription', 'membership');
                                }
                                ?>
											</td>
										<?php 
                                break;
                            case 'used':
                                ?>
											<td scope="row">
												<?php 
                                echo number_format_i18n($coupon->coupon_used);
                                ?>
											</td>
										<?php 
                                break;
                            case 'remaining':
                                ?>
											<td scope="row">
												<?php 
                                if ($coupon->coupon_uses > 0) {
                                    echo number_format_i18n(intval($coupon->coupon_uses) - intval($coupon->coupon_used));
                                } else {
                                    _e('Unlimited', 'membership');
                                }
                                ?>
											</td>
										<?php 
                                break;
                        }
                    }
                    ?>
								</tr>
								<?php 
                }
            } else {
                ?>
							<tr>
								<td colspan="8"><?php 
                _e('No coupons yet.', 'membership');
                ?>
</td>
							</tr>
						<?php 
            }
            // end if coupons
            ?>

						</tbody>
					</table>
				</form>
				<?php 
        }
示例#2
0
        ?>
			</table>
		</div>

	<?php 
    } else {
        $sub = new M_Subscription($subscription);
        $pricing = $sub->get_pricingarray();
        $coupon_code = membership_get_current_coupon();
        if (!empty($pricing) && !empty($coupon_code)) {
            $pricing = $sub->apply_coupon_pricing($coupon_code, $pricing);
        }
        ?>
		<div class='header' style='width: 750px'>
		<h1><?php 
        echo __('Sign up for', 'membership') . " " . $sub->sub_name();
        ?>
</h1>
		</div>
		<div class='fullwidth'>
			<p><?php 
        echo __('Please check the details of your subscription below and click on the relevant button to complete the subscription.', 'membership');
        ?>
</p>

			<table class='purchasetable'>
				<tr>
					<td class='detailscolumn'>
					<?php 
        echo $sub->sub_name();
        ?>
示例#3
0
function membership_record_sub_move($fromsub_id, $fromlevel_id, $tosub_id, $tolevel_id, $to_order, $user_id)
{
    global $wpdb;
    $table = membership_db_prefix($wpdb, 'membership_news');
    // Get the information
    $user = new WP_User($user_id);
    $fromsub = new M_Subscription($fromsub_id);
    $tosub = new M_Subscription($tosub_id);
    $fromlevel = new M_Level($fromlevel_id);
    $level = new M_Level($tolevel_id);
    $message = sprintf(__('<strong>%s</strong> has moved from level <strong>%s</strong> on subscription <strong>%s</strong> to level <strong>%s</strong> on subscription <strong>%s</strong>', 'membership'), $user->display_name, $fromlevel->level_title(), $fromsub->sub_name(), $level->level_title(), $tosub->sub_name());
    $wpdb->insert($table, array('newsitem' => $message, 'newsdate' => current_time('mysql')));
}
 function do_subscriptiontitle_shortcode($atts, $content = null, $code = "")
 {
     global $wp_query;
     $defaults = array("holder" => '', "holderclass" => '', "item" => '', "itemclass" => '', "postfix" => '', "prefix" => '', "wrapwith" => '', "wrapwithclass" => '', "subscription" => '');
     extract(shortcode_atts($defaults, $atts));
     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);
     $html .= $sub->sub_name();
     if (!empty($wrapwith)) {
         $html .= "</{$wrapwith}>";
     }
     $html .= $postfix;
     if (!empty($item)) {
         $html .= "</{$item}>";
     }
     if (!empty($holder)) {
         $html .= "</{$holder}>";
     }
     return $html;
 }
示例#5
0
        function handle_profile_member_page()
        {
            ?>
			<div class='wrap'>
				<div class="icon32" id="icon-users"><br></div>
				<h2><?php 
            _e('Membership details', 'membership');
            ?>
</h2>

				<?php 
            if (isset($_GET['msg'])) {
                echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            if (!current_user_is_member()) {
                // Not a member so show the message and signup forms
                ?>
						<div class='nonmembermessage'>
						<h3><?php 
                _e('Not called yet', 'membership');
                ?>
</h3>
						<?php 
                _e('Not called yet', 'membership');
                ?>
						</div>
						<div class='signups'>
						<h3><?php 
                _e('Select a subscription', 'membership');
                ?>
</h3>
						<p>
							<?php 
                _e('Please select a subscription from the options below.', 'membership');
                ?>
						</p>
						<?php 
                do_action('membership_subscription_form_before_subscriptions', $user_id);
                $subs = $this->get_subscriptions();
                do_action('membership_subscription_form_before_paid_subscriptions', $user_id);
                foreach ((array) $subs as $key => $sub) {
                    $subscription = new M_Subscription($sub->id);
                    ?>
								<div class="subscription">
									<div class="description">
										<h3><?php 
                    echo $subscription->sub_name();
                    ?>
</h3>
										<p><?php 
                    echo $subscription->sub_description();
                    ?>
</p>
									</div>

								<?php 
                    $pricing = $subscription->get_pricingarray();
                    if ($pricing) {
                        ?>
										<div class='priceforms'>
											<?php 
                        do_action('membership_purchase_button', $subscription, $pricing, $user_id);
                        ?>
										</div>
										<?php 
                    }
                    ?>
								</div>
								<?php 
                }
                do_action('membership_subscription_form_after_paid_subscriptions', $user_id);
                do_action('membership_subscription_form_after_subscriptions', $user_id);
                ?>
						</div>
					<?php 
            } else {
                if (current_user_has_subscription()) {
                    // User has a subscription already. Display the details - and an action to enable upgrading / not upgrading to take place.
                    ?>
							<div class='nonmembermessage'>
							<h3><?php 
                    _e('Not called yet', 'membership');
                    ?>
</h3>
							<?php 
                    _e('Not called yet', 'membership');
                    ?>
							</div>
						<?php 
                }
            }
            ?>
			</div> <!-- wrap -->
			<?php 
        }
示例#6
0
    function mytransactions($type = 'past')
    {
        if (empty($_GET['paged'])) {
            $paged = 1;
        } else {
            $paged = (int) $_GET['paged'];
        }
        $startat = ($paged - 1) * 50;
        $transactions = $this->get_transactions($type, $startat, 50);
        $total = $this->get_total();
        $columns = array();
        $columns['subscription'] = __('Subscription', 'membership');
        $columns['user'] = __('User', 'membership');
        $columns['date'] = __('Date', 'membership');
        $columns['amount'] = __('Amount', 'membership');
        $columns['transid'] = __('Transaction id', 'membership');
        $trans_navigation = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'total' => ceil($total / 50), 'current' => $paged));
        echo '<div class="tablenav">';
        if ($trans_navigation) {
            echo "<div class='tablenav-pages'>{$trans_navigation}</div>";
        }
        echo '</div>';
        ?>


			<table cellspacing="0" class="widefat fixed">
				<thead>
				<tr>
				<?php 
        foreach ($columns as $key => $col) {
            ?>
						<th style="" class="manage-column column-<?php 
            echo $key;
            ?>
" id="<?php 
            echo $key;
            ?>
" scope="col"><?php 
            echo $col;
            ?>
</th>
						<?php 
        }
        ?>
				</tr>
				</thead>

				<tfoot>
				<tr>
				<?php 
        reset($columns);
        foreach ($columns as $key => $col) {
            ?>
						<th style="" class="manage-column column-<?php 
            echo $key;
            ?>
" id="<?php 
            echo $key;
            ?>
" scope="col"><?php 
            echo $col;
            ?>
</th>
						<?php 
        }
        ?>
				</tr>
				</tfoot>

				<tbody>
					<?php 
        if ($transactions) {
            foreach ($transactions as $key => $transaction) {
                ?>
							<tr valign="middle" class="alternate">
								<td class="column-subscription">
									<?php 
                if (class_exists('M_Subscription')) {
                    $subscription = new M_Subscription($transaction->transaction_subscription_ID);
                    echo $subscription->sub_name();
                } else {
                    echo __('Subscription not found', 'membership');
                }
                ?>
								</td>
								<td class="column-user">
									<?php 
                if (class_exists('M_Membership')) {
                    $member = new M_Membership($transaction->transaction_user_ID);
                    echo $member->user_login;
                } else {
                    echo __('User not found', 'membership');
                }
                ?>
								</td>
								<td class="column-date">
									<?php 
                echo mysql2date("d-m-Y", $transaction->transaction_stamp);
                ?>
								</td>
								<td class="column-amount">
									<?php 
                $amount = $transaction->transaction_total_amount / 100;
                echo $transaction->transaction_currency;
                echo "&nbsp;" . number_format($amount, 2, '.', ',');
                ?>
								</td>
								<td class="column-transid">
									<?php 
                if (!empty($transaction->transaction_paypal_ID)) {
                    echo $transaction->transaction_paypal_ID;
                } else {
                    echo __('None yet', 'membership');
                }
                ?>
								</td>
						    </tr>
							<?php 
            }
        } else {
            $columncount = count($columns);
            ?>
						<tr valign="middle" class="alternate" >
							<td colspan="<?php 
            echo $columncount;
            ?>
" scope="row"><?php 
            _e('No Transactions have been found, patience is a virtue.', 'membership');
            ?>
</td>
					    </tr>
						<?php 
        }
        ?>

				</tbody>
			</table>
		<?php 
    }
?>
" method="post">
		<div class="priceboxes">
		<?php 
do_action('membership_subscription_form_before_subscriptions');
$subs = $this->get_subscriptions();
$subs = apply_filters('membership_override_subscriptions', $subs);
foreach ((array) $subs as $key => $sub) {
    $subscription = new M_Subscription($sub->id);
    ?>
				<div class="pricebox subscriptionbox" id='subscriptionbox-<?php 
    echo $subscription->id;
    ?>
'>
					<div class="topbar"><span class='title'><?php 
    echo $subscription->sub_name();
    ?>
</span></div>
					<div class="pricedetails"><?php 
    echo $subscription->sub_description();
    ?>
</div>
					<div class="bottombar"><span class='price'><?php 
    echo $subscription->sub_pricetext();
    ?>
</span>
					<?php 
    $pricing = $subscription->get_pricingarray();
    if ($pricing) {
        ?>
							<span class='link'>
示例#8
0
 function send_ping($sub_id = false, $level_id = false, $user_id = false)
 {
     $this->ping = $this->get_ping();
     if (!class_exists('WP_Http')) {
         include_once ABSPATH . WPINC . '/class-http.php';
     }
     $pingdata = $this->pingconstants;
     if (empty($user_id)) {
         $user = wp_get_current_user();
         $member = new M_Membership($user->ID);
     } else {
         $member = new M_Membership($user_id);
     }
     foreach ($pingdata as $key => $value) {
         switch ($key) {
             case '%blogname%':
                 $pingdata[$key] = get_option('blogname');
                 break;
             case '%blogurl%':
                 $pingdata[$key] = get_option('home');
                 break;
             case '%username%':
                 $pingdata[$key] = $member->user_login;
                 break;
             case '%usernicename%':
                 $pingdata[$key] = $member->user_nicename;
                 break;
             case '%useremail%':
                 $pingdata[$key] = $member->user_email;
                 break;
             case '%userid%':
                 $pingdata[$key] = $member->ID;
                 break;
             case '%networkname%':
                 $pingdata[$key] = get_site_option('site_name');
                 break;
             case '%networkurl%':
                 $pingdata[$key] = get_site_option('siteurl');
                 break;
             case '%subscriptionname%':
                 if (!$sub_id) {
                     $ids = $member->get_subscription_ids();
                     if (!empty($ids)) {
                         $sub_id = $ids[0];
                     }
                 }
                 if (!empty($sub_id)) {
                     $sub = new M_Subscription($sub_id);
                     $pingdata[$key] = $sub->sub_name();
                 } else {
                     $pingdata[$key] = '';
                 }
                 break;
             case '%levelname%':
                 if (!$level_id) {
                     $ids = $member->get_level_ids();
                     if (!empty($ids)) {
                         $levels = $ids[0];
                     }
                 }
                 if (!empty($levels->level_id)) {
                     $level = new M_Level($levels->level_id);
                     $pingdata[$key] = $level->level_title();
                 } else {
                     $pingdata[$key] = '';
                 }
                 break;
             case '%timestamp%':
                 $pingdata[$key] = time();
                 break;
             default:
                 $pingdata[$key] = apply_filter('membership_pingfield_' . $key, '');
                 break;
         }
     }
     $url = $this->ping->pingurl;
     // Globally replace the values in the ping and then make it into an array to send
     $pingmessage = str_replace(array_keys($pingdata), array_values($pingdata), $this->ping->pinginfo);
     $pingmessage = array_map('trim', explode("\n", $pingmessage));
     // make the ping message into a sendable bit of text
     $pingtosend = array();
     foreach ($pingmessage as $key => $value) {
         $temp = explode("=", $value);
         $pingtosend[$temp[0]] = $temp[1];
     }
     // Send the request
     if (class_exists('WP_Http')) {
         $request = new WP_Http();
         switch ($this->ping->pingtype) {
             case 'GET':
                 $url = untrailingslashit($url) . "?";
                 foreach ($pingtosend as $key => $val) {
                     if (substr($url, -1) != '?') {
                         $url .= "&";
                     }
                     $url .= $key . "=" . urlencode($val);
                 }
                 $result = $request->request($url, array('method' => 'GET', 'body' => ''));
                 break;
             case 'POST':
                 $result = $request->request($url, array('method' => 'POST', 'body' => $pingtosend));
                 break;
         }
         /*
         'headers': an array of response headers, such as "x-powered-by" => "PHP/5.2.1"
         'body': the response string sent by the server, as you would see it with you web browser
         'response': an array of HTTP response codes. Typically, you'll want to have array('code'=>200, 'message'=>'OK')
         'cookies': an array of cookie information
         */
         $this->add_history($pingtosend, $result);
     }
 }
 function handle_payment_return()
 {
     global $M_options, $M_membership_url;
     $return = array();
     if ($_SERVER['HTTPS'] != 'on') {
         wp_die(__('You must use HTTPS in order to do this', 'membership'));
         exit;
     }
     $coupon_code = isset($_REQUEST['remove_coupon']) ? '' : $_REQUEST['coupon_code'];
     if (empty($M_options['paymentcurrency'])) {
         $M_options['paymentcurrency'] = 'USD';
     }
     $subscription = new M_Subscription($_POST['subscription_id']);
     $pricing = $subscription->get_pricingarray();
     if (!empty($coupon_code)) {
         $pricing = $subscription->apply_coupon_pricing($coupon_code, $pricing);
     }
     $user_id = is_user_logged_in() ? get_current_user_id() : $_POST['user_id'];
     $user = get_userdata($user_id);
     $sub_id = $subscription->id;
     // A basic price or a single subscription
     if ($pricing) {
         $timestamp = time();
         if (get_option($this->gateway . "_mode", 'sandbox') == 'sandbox') {
             $endpoint = "https://test.authorize.net/gateway/transact.dll";
         } else {
             $endpoint = "https://secure.authorize.net/gateway/transact.dll";
         }
         $payment = new M_Gateway_Worker_AuthorizeNet_AIM($endpoint, get_option($this->gateway . "_delim_data", 'yes'), get_option($this->gateway . "_delim_char", ','), get_option($this->gateway . "_encap_char", ''), get_option($this->gateway . "_api_user", ''), get_option($this->gateway . "_api_key", ''), get_option($this->gateway . "_mode", 'sandbox') == 'sandbox');
         $payment->transaction($_POST['card_num']);
         $amount = number_format($pricing[0]['amount'], 2);
         // Billing Info
         $payment->setParameter("x_card_code", $_POST['card_code']);
         $payment->setParameter("x_exp_date ", $_POST['exp_month'] . $_POST['exp_year']);
         $payment->setParameter("x_amount", $amount);
         // Payment billing information passed to authorize, thanks to Kevin L. for spotting this.
         $payment->setParameter("x_first_name", $_POST['first_name']);
         $payment->setParameter("x_last_name", $_POST['last_name']);
         $payment->setParameter("x_address", $_POST['address']);
         $payment->setParameter("x_zip", $_POST['zip']);
         $payment->setParameter("x_email", is_email($user->user_email) != false ? is_email($user->user_email) : '');
         // Order Info
         $payment->setParameter("x_description", $subscription->sub_name());
         $payment->setParameter("x_duplicate_window", 30);
         // E-mail
         $payment->setParameter("x_header_email_receipt", get_option($this->gateway . "_header_email_receipt", ''));
         $payment->setParameter("x_footer_email_receipt", get_option($this->gateway . "_footer_email_receipt", ''));
         $payment->setParameter("x_email_customer", strtoupper(get_option($this->gateway . "_email_customer", '')));
         $payment->setParameter("x_customer_ip", $_SERVER['REMOTE_ADDR']);
         $payment->process();
         if ($payment->isApproved()) {
             $status = __('Processed', 'membership');
             $note = '';
             $member = new M_Membership($user_id);
             if ($member) {
                 if ($member->has_subscription() && $member->on_sub($sub_id)) {
                     remove_action('membership_expire_subscription', 'membership_record_user_expire', 10, 2);
                     remove_action('membership_add_subscription', 'membership_record_user_subscribe', 10, 4);
                     $member->expire_subscription($sub_id);
                     $member->create_subscription($sub_id, $this->gateway);
                 } else {
                     $member->create_subscription($sub_id, $this->gateway);
                 }
             }
             // TODO: create switch for handling different authorize aim respone codes
             $this->record_transaction($user_id, $sub_id, $amount, $M_options['paymentcurrency'], time(), $payment->results[6] == 0 ? 'TESTMODE' : $payment->results[6], $status, $note);
             do_action('membership_payment_subscr_signup', $user_id, $sub_id);
             $return['status'] = 'success';
             $return['redirect'] = !strpos(home_url, 'https:') ? str_replace('https:', 'http:', M_get_registrationcompleted_permalink()) : M_get_registrationcompleted_permalink();
         } else {
             $return['status'] = 'error';
             $return['errors'][] = __('Your payment was declined.  Please check all your details or use a different card.', 'membership');
         }
     } else {
         $return['status'] = 'error';
         $return['errors'][] = __('There was an issue determining the price.', 'membership');
     }
     echo json_encode($return);
     exit;
 }