当前位置: 首页>>代码示例>>PHP>>正文


PHP MemberOrder类代码示例

本文整理汇总了PHP中MemberOrder的典型用法代码示例。如果您正苦于以下问题:PHP MemberOrder类的具体用法?PHP MemberOrder怎么用?PHP MemberOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MemberOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pmpro_upgrade_1_8_9_3_ajax

function pmpro_upgrade_1_8_9_3_ajax()
{
    global $wpdb;
    $debug = false;
    $run = true;
    //some vars
    $all_levels = pmpro_getAllLevels(true, true);
    //keeping track of which user we're working on
    $last_user_id = get_option('pmpro_upgrade_1_8_9_3_last_user_id', 0);
    //get all active users during the period where things may have been broken
    $user_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' AND user_id > {$last_user_id} ORDER BY user_id LIMIT 10");
    //track progress
    $first_load = get_transient('pmpro_updates_first_load');
    if ($first_load) {
        $total_users = $wpdb->get_var("SELECT COUNT(user_id) FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' ORDER BY user_id");
        update_option('pmpro_upgrade_1_8_9_3_total', $total_users, 'no');
        $progress = 0;
    } else {
        $total_users = get_option('pmpro_upgrade_1_8_9_3_total', 0);
        $progress = get_option('pmpro_upgrade_1_8_9_3_progress', 0);
    }
    update_option('pmpro_upgrade_1_8_9_3_progress', $progress + count($user_ids), 'no');
    global $pmpro_updates_progress;
    if ($total_users > 0) {
        $pmpro_updates_progress = "[" . $progress . "/" . $total_users . "]";
    } else {
        $pmpro_updates_progress = "";
    }
    if (empty($user_ids)) {
        //done with this update
        pmpro_removeUpdate('pmpro_upgrade_1_8_9_3_ajax');
        delete_option('pmpro_upgrade_1_8_9_3_last_user_id');
        delete_option('pmpro_upgrade_1_8_9_3_total');
        delete_option('pmpro_upgrade_1_8_9_3_progress');
    } else {
        foreach ($user_ids as $user_id) {
            $last_user_id = $user_id;
            //keeping track of the last user we processed
            $user = get_userdata($user_id);
            //user not found for some reason
            if (empty($user)) {
                if ($debug) {
                    echo "User #" . $user_id . " not found.\n";
                }
                continue;
            }
            //get level
            $user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
            //has a start and end date already
            if (!empty($user->membership_level->enddate) && !empty($user->membership_level->startdate)) {
                if ($debug) {
                    echo "User #" . $user_id . ", " . $user->user_email . " already has a start and end date.\n";
                }
                continue;
            }
            //get order
            $last_order = new MemberOrder();
            $last_order->getLastMemberOrder();
            /*
            	Figure out if this user should have been given an end date.
            	The level my have an end date.
            	They might have used a discount code.
            	They might be using the set-expiration-dates code.
            	They might have custom code setting the end date.
            
            	Let's setup some vars as if we are at checkout.
            	Then pass recreate the level with the pmpro_checkout_level filter.
            	And use the end date there if there is one.
            */
            global $pmpro_level, $discount_code, $discount_code_id;
            //level
            $level_id = $user->membership_level->id;
            $_REQUEST['level'] = $level_id;
            //gateway
            if (!empty($last_order) && !empty($last_order->gateway)) {
                $_REQUEST['gateway'] = $last_order->gateway;
            } else {
                $_REQUEST['gateway'] = pmpro_getGateway();
            }
            //discount code
            $discount_code_id = $user->membership_level->code_id;
            $discount_code = $wpdb->get_var("SELECT code FROM {$wpdb->pmpro_discount_codes} WHERE id = '" . $discount_code_id . "' LIMIT 1");
            //get level
            if (!empty($discount_code_id)) {
                $sqlQuery = "SELECT l.id, cl.*, l.name, l.description, l.allow_signups FROM {$wpdb->pmpro_discount_codes_levels} cl LEFT JOIN {$wpdb->pmpro_membership_levels} l ON cl.level_id = l.id LEFT JOIN {$wpdb->pmpro_discount_codes} dc ON dc.id = cl.code_id WHERE dc.code = '" . $discount_code . "' AND cl.level_id = '" . (int) $level_id . "' LIMIT 1";
                $pmpro_level = $wpdb->get_row($sqlQuery);
                //if the discount code doesn't adjust the level, let's just get the straight level
                if (empty($pmpro_level)) {
                    $pmpro_level = $all_levels[$level_id];
                }
                //filter adjustments to the level
                $pmpro_level->code_id = $discount_code_id;
                $pmpro_level = apply_filters("pmpro_discount_code_level", $pmpro_level, $discount_code_id);
            }
            //no level yet, use default
            if (empty($pmpro_level)) {
                $pmpro_level = $all_levels[$level_id];
            }
            //no level for some reason
            if (empty($pmpro_level) && empty($pmpro_level->id)) {
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:upgrade_1_8_9_3.php

示例2: pmprodev_checkout_debug_email

function pmprodev_checkout_debug_email($level)
{
    global $pmprodev_options, $current_user, $wpdb;
    if (empty($pmprodev_options['checkout_debug_email'])) {
        return $level;
    }
    $email = new PMProEmail();
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        $http = 'https://';
    } else {
        $http = 'http://';
    }
    $email->subject = sprintf('%s Checkout Page Debug Log', get_bloginfo('name'));
    $email->recipient = $pmprodev_options['checkout_debug_email'];
    $email->template = 'checkout_debug';
    $email->body = file_get_contents(plugin_dir_path(__FILE__) . '/email/checkout_debug.html');
    $email->data = array('sitename' => get_bloginfo('sitename'), 'checkout_url' => $http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'submit' => print_r($_REQUEST['submit-checkout'], true), 'level' => print_r($level, true), 'user' => print_r($current_user->data, true), 'request' => print_r($_REQUEST, true));
    $order = new MemberOrder();
    $order->getLastMemberOrder($current_user->user_id);
    if (!empty($order)) {
        $email->data['order'] = print_r($order, true);
    }
    $email->sendEmail();
    return $level;
}
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:25,代码来源:pmpro-toolkit.php

示例3: pmproet_admin_init_test_order

function pmproet_admin_init_test_order()
{
    global $current_user, $pmproet_test_order_id;
    //make sure PMPro is activated
    if (!class_exists('MemberOrder')) {
        return;
    }
    $pmproet_test_order_id = get_option('pmproet_test_order_id');
    $test_order = new MemberOrder($pmproet_test_order_id);
    if (empty($test_order->id)) {
        $all_levels = pmpro_getAllLevels();
        if (!empty($all_levels)) {
            $first_level = array_shift($all_levels);
            $test_order->membership_id = $first_level->id;
            $test_order->InitialPayment = $first_level->initial_payment;
        } else {
            $test_order->membership_id = 1;
            $test_order->InitialPayment = 1;
        }
        $test_order->user_id = $current_user->ID;
        $test_order->cardtype = "Visa";
        $test_order->accountnumber = "4111111111111111";
        $test_order->expirationmonth = date('m', current_time('timestamp'));
        $test_order->expirationyear = intval(date('Y', current_time('timestamp'))) + 1;
        $test_order->ExpirationDate = $test_order->expirationmonth . $test_order->expirationyear;
        $test_order->CVV2 = '123';
        $test_order->FirstName = 'Jane';
        $test_order->LastName = 'Doe';
        $test_order->Address1 = '123 Street';
        $test_order->billing = new stdClass();
        $test_order->billing->name = 'Jane Doe';
        $test_order->billing->street = '123 Street';
        $test_order->billing->city = 'City';
        $test_order->billing->state = 'ST';
        $test_order->billing->country = 'US';
        $test_order->billing->zip = '12345';
        $test_order->billing->phone = '5558675309';
        $test_order->gateway_environment = 'sandbox';
        $test_order->notes = __('This is a test order used with the PMPro Email Templates addon.', 'pmpro');
        $test_order->saveOrder();
        $pmproet_test_order_id = $test_order->id;
        update_option('pmproet_test_order_id', $pmproet_test_order_id);
    }
}
开发者ID:audiblePi,项目名称:fccTest,代码行数:44,代码来源:init.php

示例4: mark_referral_complete

 public function mark_referral_complete($order)
 {
     if ('success' !== strtolower($order->status)) {
         return;
     }
     $this->complete_referral($order->id);
     $referral = affiliate_wp()->referrals->get_by('reference', $order->id, $this->context);
     $order = new MemberOrder($order->id);
     // Prevent infinite loop
     remove_action('pmpro_updated_order', array($this, 'mark_referral_complete'), 10);
     $order->affiliate_id = $referral->affiliate_id;
     $amount = html_entity_decode(affwp_currency_filter(affwp_format_amount($referral->amount)), ENT_QUOTES, 'UTF-8');
     $name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id);
     $note = sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name);
     if (empty($order->notes)) {
         $order->notes = $note;
     } else {
         $order->notes = $order->notes . "\n\n" . $note;
     }
     $order->saveOrder();
 }
开发者ID:companyjuice,项目名称:AffiliateWP,代码行数:21,代码来源:class-pmp.php

示例5: pmpro_cron_credit_card_expiring_warnings

function pmpro_cron_credit_card_expiring_warnings()
{
    global $wpdb;
    $next_month_date = date("Y-m-01", strtotime("+2 months"));
    $sqlQuery = "SELECT mu.user_id\n\t\t\t\t\t\tFROM  {$wpdb->pmpro_memberships_users} mu\n\t\t\t\t\t\t\tLEFT JOIN {$wpdb->usermeta} um1 ON mu.user_id = um1.user_id\n\t\t\t\t\t\t\t\tAND meta_key =  'pmpro_ExpirationMonth'\n\t\t\t\t\t\t\tLEFT JOIN {$wpdb->usermeta} um2 ON mu.user_id = um2.user_id\n\t\t\t\t\t\t\t\tAND um2.meta_key =  'pmpro_ExpirationYear'\n\t\t\t\t\t\t\tLEFT JOIN {$wpdb->usermeta} um3 ON mu.user_id = um3.user_id\n\t\t\t\t\t\t\t\tAND um3.meta_key = 'pmpro_credit_card_expiring_warning'\n\t\t\t\t\t\tWHERE mu.status =  'active'\n\t\t\t\t\t\t\tAND mu.cycle_number >0\n\t\t\t\t\t\t\tAND CONCAT(um2.meta_value, '-', um1.meta_value, '-01') < '" . $next_month_date . "'\n\t\t\t\t\t\t\tAND (um3.meta_value IS NULL OR CONCAT(um2.meta_value, '-', um1.meta_value, '-01') <> um3.meta_value)\n\t\t\t\t\t";
    $cc_expiring_user_ids = $wpdb->get_col($sqlQuery);
    if (!empty($cc_expiring_user_ids)) {
        require_once ABSPATH . 'wp-includes/pluggable.php';
        foreach ($cc_expiring_user_ids as $user_id) {
            //get user
            $euser = get_userdata($user_id);
            //make sure their level doesn't have a billing limit that's been reached
            $euser->membership_level = pmpro_getMembershipLevelForUser($euser->ID);
            if (!empty($euser->membership_level->billing_limit)) {
                /*
                	There is a billing limit on this level, skip for now. 
                	We should figure out how to tell if the limit has been reached
                	and if not, email the user about the expiring credit card.
                */
                continue;
            }
            //make sure they are using a credit card type billing method for their current membership level (check the last order)
            $last_order = new MemberOrder();
            $last_order->getLastMemberOrder($euser->ID);
            if (empty($last_order->accountnumber)) {
                continue;
            }
            //okay send them an email
            $send_email = apply_filters("pmpro_send_credit_card_expiring_email", true, $e->user_id);
            if ($send_email) {
                //send an email
                $pmproemail = new PMProEmail();
                $pmproemail->sendCreditCardExpiringEmail($euser);
                printf(__("Credit card expiring email sent to %s. ", "pmpro"), $euser->user_email);
            }
            //update user meta so we don't email them again
            update_user_meta($euser->ID, "pmpro_credit_card_expiring_warning", $euser->pmpro_ExpirationYear . "-" . $euser->pmpro_ExpirationMonth . "-01");
        }
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:40,代码来源:crons.php

示例6: pmpro_getOption

<?php

global $wpdb, $current_user, $pmpro_msg, $pmpro_msgt;
global $bfirstname, $blastname, $baddress1, $baddress2, $bcity, $bstate, $bzipcode, $bcountry, $bphone, $bemail, $bconfirmemail, $CardType, $AccountNumber, $ExpirationMonth, $ExpirationYear;
$gateway = pmpro_getOption("gateway");
//need to be secure?
global $besecure, $show_paypal_link;
$user_order = new MemberOrder();
$user_order->getLastMemberOrder();
if (empty($user_order->gateway)) {
    //no order
    $besecure = false;
} elseif ($user_order->gateway == "paypalexpress") {
    $besecure = pmpro_getOption("use_ssl");
    //still they might have website payments pro setup
    if ($gateway == "paypal") {
        //$besecure = true;
    } else {
        //$besecure = false;
        $show_paypal_link = true;
    }
} else {
    //$besecure = true;
    $besecure = pmpro_getOption("use_ssl");
}
//code for stripe
if ($gateway == "stripe") {
    //stripe js library
    wp_enqueue_script("stripe", "https://js.stripe.com/v1/", array(), "");
    //stripe js code for checkout
    function pmpro_stripe_javascript()
开发者ID:Willislahav,项目名称:paid-memberships-pro,代码行数:31,代码来源:billing.php

示例7: pap_pmpro_add_order

function pap_pmpro_add_order($morder)
{
    if (!empty($morder->total)) {
        //need to get the last order before this
        $last_order = new MemberOrder();
        $last_order->getLastMemberOrder($morder->user_id);
        if (!empty($last_order->affiliate_id)) {
            $parts = explode(",", $last_order->affiliate_subid);
            $affiliate_code = $last_order->affiliate_id;
            $campaign_id = $parts[0];
            $channel_id = $parts[1];
            $visitor_id = $parts[2];
            //api
            pap_pmpro_track_sale($morder->total, $morder->code, $affiliate_code, $campaign_id, $channel_id, $visitor_id);
            //update the affiliate id for this order
            global $pap_pmpro_affiliate_id, $pap_pmpro_affiliate_subid;
            $pap_pmpro_affiliate_id = $affiliate_code;
            $pap_pmpro_affiliate_subid = $campaign_id . "," . $channel_id . "," . $visitor_id;
        }
    }
}
开发者ID:sbusso,项目名称:pmpro-post-affiliate-pro,代码行数:21,代码来源:pmpro-post-affiliate-pro.php

示例8: sendToFondy

 function sendToFondy(&$order)
 {
     global $pmpro_currency;
     global $wpdb;
     //taxes on initial amount
     $initial_payment = $order->InitialPayment;
     $initial_payment_tax = $order->getTaxForPrice($initial_payment);
     $initial_payment = round((double) $initial_payment + (double) $initial_payment_tax, 2);
     $fields = array('merchant_data' => 'name=' . $order->billing->name . '=phone=' . $order->billing->phone, 'product_id' => $order->membership_id, 'subscription_callback_url' => admin_url("admin-ajax.php") . "?action=fondy-ins", 'order_id' => $order->code . FondyForm::ORDER_SEPARATOR . time(), 'merchant_id' => pmpro_getOption("fondy_merchantid"), 'order_desc' => substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), 'amount' => round($initial_payment * 100), 'currency' => $pmpro_currency, 'server_callback_url' => admin_url("admin-ajax.php") . "?action=fondy-ins", 'response_url' => admin_url("admin-ajax.php") . "?action=fondy-ins", 'sender_email' => $order->Email, 'required_rectoken' => 'Y', 'subscription' => 'Y');
     $last_subscr_order = new MemberOrder();
     //print_r ($order);
     $last = new MemberOrder($last_subscr_order->getLastMemberOrder($order->user_id, $status = 'success', $membership_id = NULL, $gateway = NULL, $gateway_environment = NULL));
     if (isset($last->user_id) && isset($last->code)) {
         $result = $wpdb->get_row("SELECT fondy_token from `{$wpdb->pmpro_membership_orders}` WHERE user_id='" . $last->user_id . "' AND code='" . $last->code . "'");
         if (isset($result->fondy_token)) {
             $fields['rectoken'] = $result->fondy_token;
         }
     }
     $fields['signature'] = FondyForm::getSignature($fields, pmpro_getOption("fondy_securitykey"));
     //print_r ($last->user_id);die;
     unset($fields['currency']);
     $data = 'currency=' . $pmpro_currency . '&';
     foreach ($fields as $key => $val) {
         $data .= $key . "=" . $val . '&';
     }
     $url = 'https://api.fondy.eu/api/checkout/url/';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, 'https://api.fondy.eu/api/checkout/url/');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     $result = curl_exec($ch);
     $str = urldecode($result);
     parse_str($str, $mass);
     $fondy_url = $mass['checkout_url'];
     wp_redirect($fondy_url);
     exit;
 }
开发者ID:cloudipsp,项目名称:wordpress,代码行数:38,代码来源:class.pmprogateway_fondy.php

示例9: pmpro_changeMembershipLevel

function pmpro_changeMembershipLevel($level, $user_id = NULL, $old_level_status = 'inactive')
{
    global $wpdb;
    global $current_user, $pmpro_error;
    if (empty($user_id)) {
        $user_id = $current_user->ID;
    }
    if (empty($user_id)) {
        $pmpro_error = __("User ID not found.", "pmpro");
        return false;
    }
    //make sure user id is int for security
    $user_id = intval($user_id);
    if (empty($level)) {
        $level = 0;
    } else {
        if (is_array($level)) {
            //custom level
        } else {
            $level_obj = pmpro_getLevel($level);
            if (empty($level_obj)) {
                $pmpro_error = __("Invalid level.", "pmpro");
                return false;
            }
            $level = $level_obj->id;
        }
    }
    //if it's a custom level, they're changing
    if (!is_array($level)) {
        //are they even changing?
        if (pmpro_hasMembershipLevel($level, $user_id)) {
            $pmpro_error = __("not changing?", "pmpro");
            return false;
            //not changing
        }
    }
    //get all active membershipships for this user
    $old_levels = pmpro_getMembershipLevelsForUser($user_id);
    //deactivate old memberships based on the old_level_status passed in (updates pmpro_memberships_users table)
    if ($old_levels) {
        foreach ($old_levels as $old_level) {
            $sql = "UPDATE {$wpdb->pmpro_memberships_users} SET `status`='{$old_level_status}', `enddate`='" . current_time('mysql') . "' WHERE `id`=" . $old_level->subscription_id;
            if (!$wpdb->query($sql)) {
                $pmpro_error = __("Error interacting with database", "pmpro") . ": " . (mysql_errno() ? mysql_error() : 'unavailable');
                return false;
            }
        }
    }
    //should we cancel their gateway subscriptions?
    $pmpro_cancel_previous_subscriptions = true;
    if (isset($_REQUEST['cancel_membership']) && $_REQUEST['cancel_membership'] == false) {
        $pmpro_cancel_previous_subscriptions = false;
    }
    $pmpro_cancel_previous_subscriptions = apply_filters("pmpro_cancel_previous_subscriptions", $pmpro_cancel_previous_subscriptions);
    //cancel any other subscriptions they have (updates pmpro_membership_orders table)
    if ($pmpro_cancel_previous_subscriptions) {
        $other_order_ids = $wpdb->get_col("SELECT id FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '" . $user_id . "' AND status = 'success' ORDER BY id DESC");
        foreach ($other_order_ids as $order_id) {
            $c_order = new MemberOrder($order_id);
            $c_order->cancel();
            if (!empty($c_order->error)) {
                $pmpro_error = $c_order->error;
            }
        }
    }
    //insert current membership
    if (!empty($level)) {
        if (is_array($level)) {
            //make sure the dates are in good formats
            if ($level['startdate'] != current_time('mysql') && $level['startdate'] != "NULL" && substr($level['startdate'], 0, 1) != "'") {
                $level['startdate'] = "'" . $level['startdate'] . "'";
            }
            if ($level['enddate'] != current_time('mysql') && $level['enddate'] != "NULL" && substr($level['enddate'], 0, 1) != "'") {
                $level['enddate'] = "'" . $level['enddate'] . "'";
            }
            //Better support mySQL Strict Mode by passing  a proper enum value for cycle_period
            if ($level['cycle_period'] == '') {
                $level['cycle_period'] = 0;
            }
            $sql = "INSERT INTO {$wpdb->pmpro_memberships_users} (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)\n\t\t\t\t\tVALUES('" . $level['user_id'] . "',\n\t\t\t\t\t'" . $level['membership_id'] . "',\n\t\t\t\t\t'" . intval($level['code_id']) . "',\n\t\t\t\t\t'" . $level['initial_payment'] . "',\n\t\t\t\t\t'" . $level['billing_amount'] . "',\n\t\t\t\t\t'" . $level['cycle_number'] . "',\n\t\t\t\t\t'" . $level['cycle_period'] . "',\n\t\t\t\t\t'" . $level['billing_limit'] . "',\n\t\t\t\t\t'" . $level['trial_amount'] . "',\n\t\t\t\t\t'" . $level['trial_limit'] . "',\n\t\t\t\t\t" . $level['startdate'] . ",\n\t\t\t\t\t" . $level['enddate'] . ")";
            if (!$wpdb->query($sql)) {
                $pmpro_error = __("Error interacting with database", "pmpro") . ": " . (mysql_errno() ? mysql_error() : 'unavailable');
                return false;
            }
        } else {
            $sql = "INSERT INTO {$wpdb->pmpro_memberships_users} (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)\n\t\t\t    VALUES (\n\t\t\t    '" . $user_id . "',\n\t\t\t    '" . $level . "',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '0',\n\t\t\t    '" . current_time('mysql') . "',\n                \t    '0000-00-00 00:00:00'\n                \t    )";
            if (!$wpdb->query($sql)) {
                $pmpro_error = __("Error interacting with database", "pmpro") . ": " . (mysql_errno() ? mysql_error() : 'unavailable');
                return false;
            }
        }
    }
    //get level id
    if (is_array($level)) {
        $level_id = $level['membership_id'];
    } else {
        $level_id = $level;
    }
    //just id
    //remove cached level
//.........这里部分代码省略.........
开发者ID:AmpleTech,项目名称:paid-memberships-pro,代码行数:101,代码来源:functions.php

示例10: pmpro_getMembershipLevelForUser

<?php

global $current_user, $pmpro_invoice;
if ($current_user->ID) {
    $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
}
/*
	Use the filter to add your gateway here if you want to show them a message on the confirmation page while their checkout is pending.
	For example, when PayPal Standard is used, we need to wait for PayPal to send a message through IPN that the payment was accepted.
	In the meantime, the order is in pending status and the confirmation page shows a message RE waiting.
*/
$gateways_with_pending_status = apply_filters('pmpro_gateways_with_pending_status', array('paypalstandard', 'twocheckout', 'gourl'));
//must be logged in
if (empty($current_user->ID) || empty($current_user->membership_level->ID) && !in_array(pmpro_getGateway(), $gateways_with_pending_status)) {
    wp_redirect(home_url());
}
//if membership is a paying one, get invoice from DB
if (!empty($current_user->membership_level) && !pmpro_isLevelFree($current_user->membership_level)) {
    $pmpro_invoice = new MemberOrder();
    $pmpro_invoice->getLastMemberOrder($current_user->ID, apply_filters("pmpro_confirmation_order_status", array("success", "pending")));
}
开发者ID:AmpleTech,项目名称:paid-memberships-pro,代码行数:21,代码来源:confirmation.php

示例11: pmpro_checkout_confirmed

 /**
  * Review and Confirmation code.
  *
  * @since 1.8		 
  */
 static function pmpro_checkout_confirmed($pmpro_confirmed)
 {
     global $pmpro_msg, $pmpro_msgt, $pmpro_level, $current_user, $pmpro_review, $pmpro_paypal_token, $discount_code, $bemail;
     //PayPal Express Call Backs
     if (!empty($_REQUEST['review'])) {
         if (!empty($_REQUEST['PayerID'])) {
             $_SESSION['payer_id'] = $_REQUEST['PayerID'];
         }
         if (!empty($_REQUEST['paymentAmount'])) {
             $_SESSION['paymentAmount'] = $_REQUEST['paymentAmount'];
         }
         if (!empty($_REQUEST['currencyCodeType'])) {
             $_SESSION['currCodeType'] = $_REQUEST['currencyCodeType'];
         }
         if (!empty($_REQUEST['paymentType'])) {
             $_SESSION['paymentType'] = $_REQUEST['paymentType'];
         }
         $morder = new MemberOrder();
         $morder->getMemberOrderByPayPalToken($_REQUEST['token']);
         $morder->Token = $morder->paypal_token;
         $pmpro_paypal_token = $morder->paypal_token;
         if ($morder->Token) {
             if ($morder->Gateway->getExpressCheckoutDetails($morder)) {
                 $pmpro_review = true;
             } else {
                 $pmpro_msg = $morder->error;
                 $pmpro_msgt = "pmpro_error";
             }
         } else {
             $pmpro_msg = __("The PayPal Token was lost.", "pmpro");
             $pmpro_msgt = "pmpro_error";
         }
     } elseif (!empty($_REQUEST['confirm'])) {
         $morder = new MemberOrder();
         $morder->getMemberOrderByPayPalToken($_REQUEST['token']);
         $morder->Token = $morder->paypal_token;
         $pmpro_paypal_token = $morder->paypal_token;
         if ($morder->Token) {
             //setup values
             $morder->membership_id = $pmpro_level->id;
             $morder->membership_name = $pmpro_level->name;
             $morder->discount_code = $discount_code;
             $morder->InitialPayment = $pmpro_level->initial_payment;
             $morder->PaymentAmount = $pmpro_level->billing_amount;
             $morder->ProfileStartDate = date("Y-m-d") . "T0:0:0";
             $morder->BillingPeriod = $pmpro_level->cycle_period;
             $morder->BillingFrequency = $pmpro_level->cycle_number;
             $morder->Email = $bemail;
             //setup level var
             $morder->getMembershipLevel();
             $morder->membership_level = apply_filters("pmpro_checkout_level", $morder->membership_level);
             //tax
             $morder->subtotal = $morder->InitialPayment;
             $morder->getTax();
             if ($pmpro_level->billing_limit) {
                 $morder->TotalBillingCycles = $pmpro_level->billing_limit;
             }
             if (pmpro_isLevelTrial($pmpro_level)) {
                 $morder->TrialBillingPeriod = $pmpro_level->cycle_period;
                 $morder->TrialBillingFrequency = $pmpro_level->cycle_number;
                 $morder->TrialBillingCycles = $pmpro_level->trial_limit;
                 $morder->TrialAmount = $pmpro_level->trial_amount;
             }
             if ($morder->confirm()) {
                 $pmpro_confirmed = true;
             } else {
                 $pmpro_msg = $morder->error;
                 $pmpro_msgt = "pmpro_error";
             }
         } else {
             $pmpro_msg = __("The PayPal Token was lost.", "pmpro");
             $pmpro_msgt = "pmpro_error";
         }
     }
     if (!empty($morder)) {
         return array("pmpro_confirmed" => $pmpro_confirmed, "morder" => $morder);
     } else {
         return $pmpro_confirmed;
     }
 }
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:85,代码来源:class.pmprogateway_paypalexpress.php

示例12: foreach

			<hr>
			<h5>Invoices</h5>
			<div class="row">
				<div class="col-md-4"><h6>Date</h6></div>
				<div class="col-md-4"><h6>Level</h6></div>
				<div class="col-md-4"><h6>Amount</h6></div>
			</div>
			<?php 
        $count = 0;
        foreach ($invoices as $invoice) {
            ?>
					<div class="row">
						<?php 
            //get an member order object
            $invoice_id = $invoice->id;
            $invoice = new MemberOrder();
            $invoice->getMemberOrderByID($invoice_id);
            $invoice->getMembershipLevel();
            ?>
						<div class="col-md-4">
							<a href="<?php 
            echo pmpro_url("invoice", "?invoice=" . $invoice->code);
            ?>
"><?php 
            echo date(get_option("date_format"), $invoice->timestamp);
            ?>
</a>
						</div>
						<div class="col-md-4">
							<?php 
            echo $invoice->membership_level->name;
开发者ID:ivan-shulev,项目名称:despreneur-academy,代码行数:31,代码来源:page-settings.php

示例13: array

//these are the meta_keys for the fields (arrays are object, property. so e.g. $theuser->ID)
$default_columns = array(array("order", "id"), array("user", "ID"), array("user", "user_login"), array("user", "first_name"), array("user", "last_name"), array("user", "user_email"), array("order", "billing", "name"), array("order", "billing", "street"), array("order", "billing", "city"), array("order", "billing", "state"), array("order", "billing", "zip"), array("order", "billing", "country"), array("order", "billing", "phone"), array("order", "membership_id"), array("level", "name"), array("order", "subtotal"), array("order", "tax"), array("order", "couponamount"), array("order", "total"), array("order", "payment_type"), array("order", "cardtype"), array("order", "accountnumber"), array("order", "expirationmonth"), array("order", "expirationyear"), array("order", "status"), array("order", "gateway"), array("order", "gateway_environment"), array("order", "payment_transaction_id"), array("order", "subscription_transactiond_id"), array("discount_code", "id"), array("discount_code", "code"));
//any extra columns
$extra_columns = apply_filters("pmpro_orders_csv_extra_columns", array());
if (!empty($extra_columns)) {
    foreach ($extra_columns as $heading => $callback) {
        $csvoutput .= "," . $heading;
    }
}
$csvoutput .= "\n";
//output
echo $csvoutput;
$csvoutput = "";
if ($order_ids) {
    foreach ($order_ids as $order_id) {
        $order = new MemberOrder();
        $order->nogateway = true;
        $order->getMemberOrderByID($order_id);
        $user = get_userdata($order->user_id);
        $level = $order->getMembershipLevel();
        $sqlQuery = "SELECT c.id, c.code FROM {$wpdb->pmpro_discount_codes_uses} cu LEFT JOIN {$wpdb->pmpro_discount_codes} c ON cu.code_id = c.id WHERE cu.order_id = '" . $order_id . "' LIMIT 1";
        $discount_code = $wpdb->get_row($sqlQuery);
        //default columns
        if (!empty($default_columns)) {
            $count = 0;
            foreach ($default_columns as $col) {
                //add comma after the first item
                $count++;
                if ($count > 1) {
                    $csvoutput .= ",";
                }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:orders-csv.php

示例14: array

$pfData = array();
$pfHost = ($gateway_environment == 'sandbox' ? 'sandbox' : 'www') . '.payfast.co.za';
$pfOrderId = '';
$pfParamString = '';
ipnlog('PayFast ITN call received');
//// Notify PayFast that information has been received
if (!$pfError && !$pfDone) {
    header('HTTP/1.0 200 OK');
    flush();
}
//// Get data sent by PayFast
if (!$pfError && !$pfDone) {
    ipnlog('Get posted data');
    // Posted variables from ITN
    $pfData = pmpro_pfGetData();
    $morder = new MemberOrder($pfData['m_payment_id']);
    $morder->getMembershipLevel();
    $morder->getUser();
    ipnlog('PayFast Data: ' . print_r($pfData, true));
    if ($pfData === false) {
        $pfError = true;
        $pfErrMsg = PF_ERR_BAD_ACCESS;
    }
}
//// Verify security signature
if (!$pfError && !$pfDone) {
    ipnlog('Verify security signature');
    // If signature different, log for debugging
    if (!pmpro_pfValidSignature($pfData, $pfParamString)) {
        $pfError = true;
        $pfErrMsg = PF_ERR_INVALID_SIGNATURE;
开发者ID:AmpleTech,项目名称:paid-memberships-pro,代码行数:31,代码来源:payfast_itn_handler.php

示例15: cancelSubscriptionAtGateway

 /**
  * Helper method to cancel a subscription at Stripe and also clear up any upaid invoices.
  *
  * @since 1.8
  */
 function cancelSubscriptionAtGateway($subscription)
 {
     //need a valid sub
     if (empty($subscription->id)) {
         return false;
     }
     //make sure we get the customer for this subscription
     $order = new MemberOrder();
     $order->getLastMemberOrderBySubscriptionTransactionID($subscription->id);
     //no order?
     if (empty($order)) {
         //lets cancel anyway, but this is suspicious
         $r = $subscription->cancel();
         return true;
     }
     //okay have an order, so get customer so we can cancel invoices too
     $this->getCustomer($order);
     //get open invoices
     $invoices = $this->customer->invoices();
     $invoices = $invoices->all();
     //found it, cancel it
     try {
         //find any open invoices for this subscription and forgive them
         if (!empty($invoices)) {
             foreach ($invoices->data as $invoice) {
                 if (!$invoice->closed && $invoice->subscription == $subscription->id) {
                     $invoice->closed = true;
                     $invoice->save();
                 }
             }
         }
         //cancel
         $r = $subscription->cancel();
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:nwmcinc,项目名称:paid-memberships-pro,代码行数:43,代码来源:class.pmprogateway_stripe.php


注:本文中的MemberOrder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。