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


PHP PMProEmail类代码示例

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


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

示例1: 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

示例2: pmproeewe_extra_emails

function pmproeewe_extra_emails()
{
    global $wpdb;
    //make sure we only run once a day
    $today = date("Y-m-d 00:00:00");
    /*
    	Here is where you set how many emails you want to send, how early, and which template files to e-mail.
    	If you set the template file to an empty string '' then it will send the default PMPro expiring e-mail.
    	Place your email templates in a subfolder of your active theme. Create a paid-memberships-pro folder in your theme folder,
    	and then create an email folder within that. Your template files should have a suffix of .html, but you don't put it below. So if you
    	create a file in there called myexpirationemail.html, then you'd just put 'myexpirationemail' in the array below.
    	(PMPro will fill in the .html for you.)
    */
    $emails = array(30 => 'mem_expiring_30days', 60 => 'mem_expiring_60days', 90 => 'mem_expiring_90days');
    //<--- !!! UPDATE THIS ARRAY TO CHANGE WHEN EMAILS GO OUT AND THEIR TEMPLATE FILES !!! -->
    ksort($emails, SORT_NUMERIC);
    //array to store ids of folks we sent emails to so we don't email them twice
    $sent_emails = array();
    foreach (array_keys($emails) as $days) {
        //look for memberships that are going to expire within one week (but we haven't emailed them within a week)
        $sqlQuery = "SELECT mu.user_id, mu.membership_id, mu.startdate, mu.enddate FROM {$wpdb->pmpro_memberships_users} mu LEFT JOIN {$wpdb->usermeta} um ON um.user_id = mu.user_id AND um.meta_key = 'pmpro_expiration_notice_" . $days . "' WHERE mu.status = 'active' AND mu.enddate IS NOT NULL AND mu.enddate <> '' AND mu.enddate <> '0000-00-00 00:00:00' AND DATE_SUB(mu.enddate, INTERVAL " . $days . " Day) <= '" . $today . "' AND (um.meta_value IS NULL OR DATE_ADD(um.meta_value, INTERVAL " . $days . " Day) <= '" . $today . "') ORDER BY mu.enddate";
        $expiring_soon = $wpdb->get_results($sqlQuery);
        foreach ($expiring_soon as $e) {
            if (!in_array($e->user_id, $sent_emails)) {
                //send an email
                $pmproemail = new PMProEmail();
                $euser = get_userdata($e->user_id);
                if ($euser) {
                    $euser->membership_level = pmpro_getMembershipLevelForUser($euser->ID);
                    $pmproemail->email = $euser->user_email;
                    $pmproemail->subject = sprintf(__("Your membership at %s will end soon", "pmpro"), get_option("blogname"));
                    if (strlen($emails[$days]) > 0) {
                        $pmproemail->template = $emails[$days];
                    } else {
                        $pmproemail->template = "membership_expiring";
                    }
                    $pmproemail->data = array("subject" => $pmproemail->subject, "name" => $euser->display_name, "user_login" => $euser->user_login, "sitename" => get_option("blogname"), "membership_id" => $euser->membership_level->id, "membership_level_name" => $euser->membership_level->name, "siteemail" => pmpro_getOption("from_email"), "login_link" => wp_login_url(), "enddate" => date(get_option('date_format'), $euser->membership_level->enddate), "display_name" => $euser->display_name, "user_email" => $euser->user_email);
                    $pmproemail->sendEmail();
                    printf(__("Membership expiring email sent to %s. ", "pmpro"), $euser->user_email);
                    $sent_emails[] = $e->user_id;
                }
            }
            //update user meta so we don't email them again
            update_user_meta($e->user_id, "pmpro_expiration_notice_" . $days, $today);
        }
    }
}
开发者ID:greathmaster,项目名称:pmpro-extra-expiration-warning-emails,代码行数:47,代码来源:pmpro-extra-expiration-warning-emails.php

示例3: pmprosl_pmpro_default_registration_level

function pmprosl_pmpro_default_registration_level($user_id)
{
    global $pmpro_level;
    //if default is set and we're not otherwise checking out
    $default_level = get_option('pmpro_social_login_default_level');
    if (!empty($default_level) && empty($pmpro_level) && empty($_REQUEST['level'])) {
        pmpro_changeMembershipLevel($default_level, $user_id);
        $user = get_userdata($user_id);
        $user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
        //send email to member
        $pmproemail = new PMProEmail();
        $pmproemail->sendCheckoutEmail($user, false);
        //send email to admin
        $pmproemail = new PMProEmail();
        $pmproemail->sendCheckoutAdminEmail($user, false);
    }
}
开发者ID:messica,项目名称:pmpro-social-login,代码行数:17,代码来源:pmpro-social-login.php

示例4: pmpro_delete_user

function pmpro_delete_user($user_id = NULL)
{
    global $wpdb;
    //changing their membership level to 0 will cancel any subscription and remove their membership level entry
    //we don't remove the orders because it would affect reporting
    if (pmpro_changeMembershipLevel(0, $user_id)) {
        //okay
    } else {
        //couldn't delete the subscription
        //we should probably notify the admin
        global $pmpro_error;
        if (!empty($pmpro_error)) {
            $pmproemail = new PMProEmail();
            $pmproemail->data = array("body" => "<p>" . sprintf(__("There was an error canceling the subscription for user with ID=%s. You will want to check your payment gateway to see if their subscription is still active.", "pmpro"), strval($user_id)) . "</p><p>Error: " . $pmpro_error . "</p>");
            $last_order = $wpdb->get_row("SELECT * FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '" . $user_id . "' ORDER BY timestamp DESC LIMIT 1");
            if (!empty($last_order)) {
                $pmproemail->data["body"] .= "<p>Last Invoice:<br />" . nl2br(var_export($last_order, true)) . "</p>";
            }
            $pmproemail->sendEmail(get_bloginfo("admin_email"));
        }
    }
}
开发者ID:Willislahav,项目名称:paid-memberships-pro,代码行数:22,代码来源:cleanup.php

示例5: pmpro_cron_trial_ending_warnings

function pmpro_cron_trial_ending_warnings()
{
    global $wpdb;
    //make sure we only run once a day
    $today = date("Y-m-d 00:00:00");
    $pmpro_email_days_before_trial_end = apply_filters("pmpro_email_days_before_trial_end", 7);
    //look for memberships with trials ending soon (but we haven't emailed them within a week)
    $sqlQuery = "\n\t\tSELECT \n\t\t\tmu.user_id, mu.membership_id, mu.startdate, mu.cycle_period, mu.trial_limit FROM {$wpdb->pmpro_memberships_users} mu LEFT JOIN {$wpdb->usermeta} um ON um.user_id = mu.user_id AND um.meta_key = 'pmpro_trial_ending_notice' \n\t\tWHERE \n\t\t\tmu.status = 'active' AND mu.trial_limit IS NOT NULL AND mu.trial_limit > 0 AND\n\t\t\t(\n\t\t\t\t(cycle_period = 'Day' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Day) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) OR\n\t\t\t\t(cycle_period = 'Week' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Week) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) OR\n\t\t\t\t(cycle_period = 'Month' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Month) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) OR\n\t\t\t\t(cycle_period = 'Year' AND DATE_ADD(mu.startdate, INTERVAL mu.trial_limit Year) <= DATE_ADD('" . $today . "', INTERVAL " . $pmpro_email_days_before_trial_end . " Day)) \n\t\t\t)\t\t\n\t\t\t\t\t\t\n\t\t\tAND (um.meta_value IS NULL OR um.meta_value = '' OR DATE_ADD(um.meta_value, INTERVAL " . $pmpro_email_days_before_trial_end . " Day) <= '" . $today . "') \n\t\tORDER BY mu.startdate";
    $trial_ending_soon = $wpdb->get_results($sqlQuery);
    foreach ($trial_ending_soon as $e) {
        $send_email = apply_filters("pmpro_send_trial_ending_email", true, $e->user_id);
        if ($send_email) {
            //send an email
            $pmproemail = new PMProEmail();
            $euser = get_userdata($e->user_id);
            $pmproemail->sendTrialEndingEmail($euser);
            printf(__("Trial ending email sent to %s. ", "pmpro"), $euser->user_email);
        }
        //update user meta so we don't email them again
        update_user_meta($euser->ID, "pmpro_trial_ending_notice", $today);
    }
}
开发者ID:Willislahav,项目名称:paid-memberships-pro,代码行数:22,代码来源:crons.php

示例6: pmpro_insSaveOrder

function pmpro_insSaveOrder($txnref, $last_order)
{
    global $wpdb;
    //check that txn_id has not been previously processed
    $old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txnref . "' LIMIT 1");
    if (empty($old_txn)) {
        //hook for successful subscription payments
        do_action("pmpro_subscription_payment_completed");
        //save order
        $morder = new MemberOrder();
        $morder->user_id = $last_order->user_id;
        $morder->membership_id = $last_order->membership_id;
        $morder->payment_transaction_id = $txnref;
        $morder->subscription_transaction_id = $last_order->subscription_transaction_id;
        $morder->InitialPayment = $last_order->InitialPayment;
        //$_POST['item_list_amount_1'];	//not the initial payment, but the class is expecting that
        $morder->PaymentAmount = $last_order->PaymentAmount;
        //$_POST['item_list_amount_1'];
        $morder->gateway = $last_order->gateway;
        $morder->gateway_environment = $last_order->gateway_environment;
        //save
        $morder->saveOrder();
        $pmproemail = new PMProEmail();
        $pmproemail->sendInvoiceEmail($user_id, $morder);
        $user = get_userdata($morder->user_id);
        $user->membership_level = $morder->membership_level;
        //make sure they have the right level info
        //send email to member
        $pmproemail = new PMProEmail();
        $pmproemail->sendCheckoutEmail($user_id, $morder);
        //send email to admin
        $pmproemail = new PMProEmail();
        $pmproemail->sendCheckoutAdminEmail($user_id, $morder);
        $morder->getMemberOrderByID($morder->id);
        // //email the user their invoice
        $pmproemail = new PMProEmail();
        $pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
        if (strpos(PMPRO_INS_DEBUG, "@")) {
            $log_email = PMPRO_INS_DEBUG;
        } else {
            $log_email = get_option("admin_email");
        }
        inslog("New order (" . $morder->code . ") created.");
        return true;
    } else {
        inslog("Duplicate Transaction ID: " . $txnref);
        return false;
    }
}
开发者ID:Madu-rosh,项目名称:MIGS-for-paid-membership-pro,代码行数:49,代码来源:paymenthandler.php

示例7: pmpro_ipnSaveOrder

function pmpro_ipnSaveOrder($txn_id, $last_order)
{
    global $wpdb;
    //check that txn_id has not been previously processed
    $old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txn_id . "' LIMIT 1");
    if (empty($old_txn)) {
        //hook for successful subscription payments
        do_action("pmpro_subscription_payment_completed");
        //save order
        $morder = new MemberOrder();
        $morder->user_id = $last_order->user_id;
        $morder->membership_id = $last_order->membership_id;
        $morder->payment_transaction_id = $txn_id;
        $morder->subscription_transaction_id = $last_order->subscription_transaction_id;
        $morder->gateway = $last_order->gateway;
        $morder->gateway_environment = $last_order->gateway_environment;
        // Payment Status
        $morder->status = 'success';
        // We have confirmed that and thats the reason we are here.
        // Payment Type.
        $morder->payment_type = $last_order->payment_type;
        //set amount based on which PayPal type
        if ($last_order->gateway == "paypal") {
            $morder->InitialPayment = $_POST['amount'];
            //not the initial payment, but the class is expecting that
            $morder->PaymentAmount = $_POST['amount'];
        } elseif ($last_order->gateway == "paypalexpress") {
            $morder->InitialPayment = $_POST['amount'];
            //not the initial payment, but the class is expecting that
            $morder->PaymentAmount = $_POST['amount'];
        } elseif ($last_order->gateway == "paypalstandard") {
            $morder->InitialPayment = $_POST['mc_gross'];
            //not the initial payment, but the class is expecting that
            $morder->PaymentAmount = $_POST['mc_gross'];
        }
        $morder->FirstName = $_POST['first_name'];
        $morder->LastName = $_POST['last_name'];
        $morder->Email = $_POST['payer_email'];
        //get address info if appropriate
        if ($last_order->gateway == "paypal") {
            $morder->Address1 = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
            $morder->City = get_user_meta($last_order->user_id, "pmpro_bcity", true);
            $morder->State = get_user_meta($last_order->user_id, "pmpro_bstate", true);
            $morder->CountryCode = "US";
            $morder->Zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
            $morder->PhoneNumber = get_user_meta($last_order->user_id, "pmpro_bphone", true);
            $morder->billing->name = $_POST['first_name'] . " " . $_POST['last_name'];
            $morder->billing->street = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
            $morder->billing->city = get_user_meta($last_order->user_id, "pmpro_bcity", true);
            $morder->billing->state = get_user_meta($last_order->user_id, "pmpro_bstate", true);
            $morder->billing->zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
            $morder->billing->country = get_user_meta($last_order->user_id, "pmpro_bcountry", true);
            $morder->billing->phone = get_user_meta($last_order->user_id, "pmpro_bphone", true);
            //get CC info that is on file
            $morder->cardtype = get_user_meta($last_order->user_id, "pmpro_CardType", true);
            $morder->accountnumber = hideCardNumber(get_user_meta($last_order->user_id, "pmpro_AccountNumber", true), false);
            $morder->expirationmonth = get_user_meta($last_order->user_id, "pmpro_ExpirationMonth", true);
            $morder->expirationyear = get_user_meta($last_order->user_id, "pmpro_ExpirationYear", true);
            $morder->ExpirationDate = $morder->expirationmonth . $morder->expirationyear;
            $morder->ExpirationDate_YdashM = $morder->expirationyear . "-" . $morder->expirationmonth;
        }
        //save
        $morder->saveOrder();
        $morder->getMemberOrderByID($morder->id);
        //email the user their invoice
        $pmproemail = new PMProEmail();
        $pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
        ipnlog("New order (" . $morder->code . ") created.");
        return true;
    } else {
        ipnlog("Duplicate Transaction ID: " . $txn_id);
        return false;
    }
}
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:74,代码来源:ipnhandler.php

示例8: trim

     $morder->billing->street = trim($baddress1 . " " . $baddress2);
     $morder->billing->city = $bcity;
     $morder->billing->state = $bstate;
     $morder->billing->country = $bcountry;
     $morder->billing->zip = $bzipcode;
     $morder->billing->phone = $bphone;
     //$gateway = pmpro_getOption("gateway");
     $morder->gateway = $gateway;
     $morder->setGateway();
     $worked = $morder->updateBilling();
     if ($worked) {
         //send email to member
         $pmproemail = new PMProEmail();
         $pmproemail->sendBillingEmail($current_user, $morder);
         //send email to admin
         $pmproemail = new PMProEmail();
         $pmproemail->sendBillingAdminEmail($current_user, $morder);
     }
 } else {
     $worked = true;
 }
 if ($worked) {
     //update the user meta too
     $meta_keys = array("pmpro_bfirstname", "pmpro_blastname", "pmpro_baddress1", "pmpro_baddress2", "pmpro_bcity", "pmpro_bstate", "pmpro_bzipcode", "pmpro_bphone", "pmpro_bemail", "pmpro_CardType", "pmpro_AccountNumber", "pmpro_ExpirationMonth", "pmpro_ExpirationYear");
     $meta_values = array($bfirstname, $blastname, $baddress1, $baddress2, $bcity, $bstate, $bzipcode, $bphone, $bemail, $CardType, hideCardNumber($AccountNumber), $ExpirationMonth, $ExpirationYear);
     pmpro_replaceUserMeta($current_user->ID, $meta_keys, $meta_values);
     //message
     $pmpro_msg = sprintf(__('Information updated. <a href="%s">&laquo; back to my account</a>', 'pmpro'), pmpro_url("account"));
     $pmpro_msgt = "pmpro_success";
 } else {
     $pmpro_msg = $morder->error;
开发者ID:Willislahav,项目名称:paid-memberships-pro,代码行数:31,代码来源:billing.php

示例9: die

    $old_order->getLastMemberOrderBySubscriptionTransactionID($webhookNotification->subscription->id);
    if (empty($old_order)) {
        die("Couldn't find old order for failed payment with subscription id=" . $webhookNotification->subscription->id);
    }
    //generate billing failure email
    do_action("pmpro_subscription_cancelled", $old_order);
    $transaction = $webhookNotification->transactions[0];
    //prep this order for the failure emails
    $morder = new MemberOrder();
    $morder->user_id = $user_id;
    $morder->billing->name = trim($transaction->billing_details->first_name . " " . $transaction->billing_details->first_name);
    $morder->billing->street = $transaction->billing_details->street_address;
    $morder->billing->city = $transaction->billing_details->locality;
    $morder->billing->state = $transaction->billing_details->region;
    $morder->billing->zip = $transaction->billing_details->postal_code;
    $morder->billing->country = $transaction->billing_details->country_code_alpha2;
    $morder->billing->phone = $old_order->billing->phone;
    //get CC info that is on file
    $morder->cardtype = get_user_meta($user_id, "pmpro_CardType", true);
    $morder->accountnumber = hideCardNumber(get_user_meta($user_id, "pmpro_AccountNumber", true), false);
    $morder->expirationmonth = get_user_meta($user_id, "pmpro_ExpirationMonth", true);
    $morder->expirationyear = get_user_meta($user_id, "pmpro_ExpirationYear", true);
    // Email the user and ask them to update their credit card information
    $pmproemail = new PMProEmail();
    $pmproemail->sendBillingFailureEmail($user, $morder);
    // Email admin so they are aware of the failure
    $pmproemail = new PMProEmail();
    $pmproemail->sendBillingFailureAdminEmail(get_bloginfo("admin_email"), $morder);
    echo "Sent email to the member and site admin. Thanks.";
    exit;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:braintree-webhook.php

示例10: pmpro_ipnSaveOrder

function pmpro_ipnSaveOrder($txn_id, $last_order)
{
    global $wpdb;
    //check that txn_id has not been previously processed
    $old_txn = $wpdb->get_var("SELECT payment_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE payment_transaction_id = '" . $txn_id . "' LIMIT 1");
    if (empty($old_txn)) {
        //save order
        $morder = new MemberOrder();
        $morder->user_id = $last_order->user_id;
        $morder->membership_id = $last_order->membership_id;
        $morder->payment_transaction_id = $txn_id;
        $morder->subscription_transaction_id = $last_order->subscription_transaction_id;
        $morder->gateway = $last_order->gateway;
        $morder->gateway_environment = $last_order->gateway_environment;
        // Payment Status
        $morder->status = 'success';
        // We have confirmed that and thats the reason we are here.
        // Payment Type.
        $morder->payment_type = $last_order->payment_type;
        //set amount based on which PayPal type
        if (false !== stripos($last_order->gateway, "paypal")) {
            if (isset($_POST['amount']) && !empty($_POST['amount'])) {
                $morder->InitialPayment = $_POST['amount'];
                //not the initial payment, but the class is expecting that
                $morder->PaymentAmount = $_POST['amount'];
            } elseif (isset($_POST['mc_gross']) && !empty($_POST['mc_gross'])) {
                $morder->InitialPayment = $_POST['mc_gross'];
                //not the initial payment, but the class is expecting that
                $morder->PaymentAmount = $_POST['mc_gross'];
            } elseif (isset($_POST['payment_gross']) && !empty($_POST['payment_gross'])) {
                $morder->InitialPayment = $_POST['payment_gross'];
                //not the initial payment, but the class is expecting that
                $morder->PaymentAmount = $_POST['payment_gross'];
            }
        }
        $morder->FirstName = $_POST['first_name'];
        $morder->LastName = $_POST['last_name'];
        $morder->Email = $_POST['payer_email'];
        //get address info if appropriate
        if ($last_order->gateway == "paypal") {
            $morder->Address1 = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
            $morder->City = get_user_meta($last_order->user_id, "pmpro_bcity", true);
            $morder->State = get_user_meta($last_order->user_id, "pmpro_bstate", true);
            $morder->CountryCode = "US";
            $morder->Zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
            $morder->PhoneNumber = get_user_meta($last_order->user_id, "pmpro_bphone", true);
            $morder->billing->name = $_POST['first_name'] . " " . $_POST['last_name'];
            $morder->billing->street = get_user_meta($last_order->user_id, "pmpro_baddress1", true);
            $morder->billing->city = get_user_meta($last_order->user_id, "pmpro_bcity", true);
            $morder->billing->state = get_user_meta($last_order->user_id, "pmpro_bstate", true);
            $morder->billing->zip = get_user_meta($last_order->user_id, "pmpro_bzip", true);
            $morder->billing->country = get_user_meta($last_order->user_id, "pmpro_bcountry", true);
            $morder->billing->phone = get_user_meta($last_order->user_id, "pmpro_bphone", true);
            //get CC info that is on file
            $morder->cardtype = get_user_meta($last_order->user_id, "pmpro_CardType", true);
            $morder->accountnumber = hideCardNumber(get_user_meta($last_order->user_id, "pmpro_AccountNumber", true), false);
            $morder->expirationmonth = get_user_meta($last_order->user_id, "pmpro_ExpirationMonth", true);
            $morder->expirationyear = get_user_meta($last_order->user_id, "pmpro_ExpirationYear", true);
            $morder->ExpirationDate = $morder->expirationmonth . $morder->expirationyear;
            $morder->ExpirationDate_YdashM = $morder->expirationyear . "-" . $morder->expirationmonth;
        }
        //figure out timestamp or default to none (today)
        if (!empty($_POST['payment_date'])) {
            $morder->timestamp = strtotime($_POST['payment_date']);
        }
        // Save the event ID for the last processed user/IPN (in case we want to be able to replay IPN requests)
        $ipn_id = isset($_POST['ipn_track_id']) ? sanitize_text_field($_POST['ipn_track_id']) : null;
        // Allow extraction of the IPN Track ID from the order notes (if needed)
        $morder->notes = "{$morder->notes} [IPN_ID]{$ipn_id}[/IPN_ID]";
        /**
         * Post processing for a specific subscription related IPN event ID
         *
         * @param       string      $ipn_id     - The ipn_track_id from the PayPal IPN request
         * @param       MemberOrder $morder     - The completed Member Order object for the IPN request
         */
        do_action('pmpro_subscription_ipn_event_processed', $ipn_id, $morder);
        if (!is_null($ipn_id)) {
            if (false === update_user_meta($morder->user_id, "pmpro_last_{$morder->gateway}_ipn_id", $ipn_id)) {
                ipnlog("Unable to save the IPN event ID ({$ipn_id}) to usermeta for {$morder->user_id} ");
            }
        }
        //save
        $morder->saveOrder();
        $morder->getMemberOrderByID($morder->id);
        //email the user their invoice
        $pmproemail = new PMProEmail();
        $pmproemail->sendInvoiceEmail(get_userdata($last_order->user_id), $morder);
        //hook for successful subscription payments
        do_action("pmpro_subscription_payment_completed", $morder);
        ipnlog("New order (" . $morder->code . ") created.");
        return true;
    } else {
        ipnlog("Duplicate Transaction ID: " . $txn_id);
        return false;
    }
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:96,代码来源:ipnhandler.php

示例11: sendEmail

 function sendEmail($post_ids, $user_id)
 {
     if (!class_exists("PMProEmail")) {
         return;
     }
     $email = new PMProEmail();
     $user = get_user_by('id', $user_id);
     //build list of posts
     $post_list = "<ul>\n";
     foreach ($post_ids as $post_id) {
         $post_list .= '<li><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></li>' . "\n";
     }
     $post_list .= "</ul>\n";
     $email->email = $user->user_email;
     $email->subject = sprintf(__("New content is available at %s", "pmpro"), get_option("blogname"));
     $email->template = "new_content";
     //check for custom email template
     if (file_exists(get_stylesheet_directory() . '/paid-memberships-pro/series/new_content.html')) {
         $template_path = get_stylesheet_directory() . '/paid-memberships-pro/series/new_content.html';
     } elseif (file_exists(get_template_directory() . '/paid-memberships-pro/series/new_content.html')) {
         $template_path = get_template_directory() . '/paid-memberships-pro/series/new_content.html';
     } else {
         $template_path = plugins_url('email/new_content.html', dirname(__FILE__));
     }
     $email->body = file_get_contents($template_path);
     $email->data = array("name" => $user->display_name, "sitename" => get_option("blogname"), "post_list" => $post_list, "login_link" => wp_login_url());
     if (!empty($post->post_excerpt)) {
         $email->data['excerpt'] = '<p>An excerpt of the post is below.</p><p>' . $post->post_excerpt . '</p>';
     } else {
         $email->data['excerpt'] = '';
     }
     $email->sendEmail();
 }
开发者ID:greathmaster,项目名称:pmpro-series,代码行数:33,代码来源:class.pmproseries.php

示例12: wp_redirect

global $besecure;
$besecure = false;
global $current_user, $pmpro_msg, $pmpro_msgt, $pmpro_confirm, $pmpro_error;
//if they don't have a membership, send them back to the subscription page
if (empty($current_user->membership_level->ID)) {
    wp_redirect(pmpro_url("levels"));
}
if (isset($_REQUEST['confirm'])) {
    $pmpro_confirm = $_REQUEST['confirm'];
} else {
    $pmpro_confirm = false;
}
if ($pmpro_confirm) {
    $old_level_id = $current_user->membership_level->id;
    $worked = pmpro_changeMembershipLevel(false, $current_user->ID);
    if ($worked === true && empty($pmpro_error)) {
        $pmpro_msg = __("Your membership has been cancelled.", 'pmpro');
        $pmpro_msgt = "pmpro_success";
        //send an email to the member
        $myemail = new PMProEmail();
        $myemail->sendCancelEmail();
        //send an email to the admin
        $myemail = new PMProEmail();
        $myemail->sendCancelAdminEmail($current_user, $old_level_id);
    } else {
        global $pmpro_error;
        $pmpro_msg = $pmpro_error;
        $pmpro_msgt = "pmpro_error";
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:30,代码来源:cancel.php

示例13: pmpro_stripeWebhookExit

         $pmproemail->sendBillingFailureAdminEmail(get_bloginfo("admin_email"), $morder);
         $logstr .= "Subscription payment failed on order ID #" . $old_order->id . ". Sent email to the member and site admin.";
         pmpro_stripeWebhookExit();
     } else {
         $logstr .= "Could not find the related subscription for event with ID #" . $event->id . ".";
         if (!empty($event->data->object->customer)) {
             $logstr .= " Customer ID #" . $event->data->object->customer . ".";
         }
         pmpro_stripeWebhookExit();
     }
 } elseif ($event->type == "customer.subscription.deleted") {
     //for one of our users? if they still have a membership, notify the admin
     $user = getUserFromCustomerEvent($event, "success", true);
     if (!empty($user->ID)) {
         do_action("pmpro_stripe_subscription_deleted", $user->ID);
         $pmproemail = new PMProEmail();
         $pmproemail->data = array("body" => "<p>" . sprintf(__("%s has had their payment subscription cancelled by Stripe. Please check that this user's membership is cancelled on your site if it should be.", "pmpro"), $user->display_name . " (" . $user->user_login . ", " . $user->user_email . ")") . "</p>");
         $pmproemail->sendEmail(get_bloginfo("admin_email"));
         $logstr .= "Subscription deleted for user ID #" . $user->ID . ". Event ID #" . $event->id . ".";
         pmpro_stripeWebhookExit();
     } else {
         //check for any user at all
         $user = getUserFromCustomerEvent($event);
         if (!empty($user->ID)) {
             $logstr .= "Stripe tells us a subscription is deleted. This was probably initiated from PMPro and the membership/order is already cancelled. Event ID #" . $event->id . ".";
         } else {
             $logstr .= "Stripe tells us a subscription is deleted, but we could not find a user here for that subscription. Could be a subscription managed by a different app or plugin. Event ID #" . $event->id . ".";
         }
         pmpro_stripeWebhookExit();
     }
 }
开发者ID:nwmcinc,项目名称:paid-memberships-pro,代码行数:31,代码来源:stripe-webhook.php

示例14: pmpro_membership_level_profile_fields_update

function pmpro_membership_level_profile_fields_update()
{
    //get the user id
    global $wpdb, $current_user, $user_ID;
    get_currentuserinfo();
    if (!empty($_REQUEST['user_id'])) {
        $user_ID = $_REQUEST['user_id'];
    }
    $membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
    if (!current_user_can($membership_level_capability)) {
        return false;
    }
    //level change
    if (isset($_REQUEST['membership_level'])) {
        //if the level is being set to 0 by the admin, it's a cancellation.
        $changed_or_cancelled = '';
        if ($_REQUEST['membership_level'] === 0 || $_REQUEST['membership_level'] === '0' || $_REQUEST['membership_level'] == '') {
            $changed_or_cancelled = 'admin_cancelled';
        } else {
            $changed_or_cancelled = 'admin_changed';
        }
        //if the cancel at gateway box is not checked, don't cancel
        if (empty($_REQUEST['cancel_subscription'])) {
            add_filter('pmpro_cancel_previous_subscriptions', 'pmpro_cancel_previous_subscriptions_false');
        }
        //do the change
        if (pmpro_changeMembershipLevel($_REQUEST['membership_level'], $user_ID, $changed_or_cancelled)) {
            //it changed. send email
            $level_changed = true;
        }
        //remove filter after ward
        if (empty($_REQUEST['cancel_subscription'])) {
            remove_filter('pmpro_cancel_previous_subscriptions', 'pmpro_cancel_previous_subscriptions_false');
        }
    }
    //expiration change
    if (!empty($_REQUEST['expires'])) {
        //update the expiration date
        $expiration_date = intval($_REQUEST['expires_year']) . "-" . str_pad(intval($_REQUEST['expires_month']), 2, "0", STR_PAD_LEFT) . "-" . str_pad(intval($_REQUEST['expires_day']), 2, "0", STR_PAD_LEFT);
        $sqlQuery = "UPDATE {$wpdb->pmpro_memberships_users} SET enddate = '" . $expiration_date . "' WHERE status = 'active' AND membership_id = '" . intval($_REQUEST['membership_level']) . "' AND user_id = '" . $user_ID . "' LIMIT 1";
        if ($wpdb->query($sqlQuery)) {
            $expiration_changed = true;
        }
    } elseif (isset($_REQUEST['expires'])) {
        //already blank? have to check for null or '0000-00-00 00:00:00' or '' here.
        $sqlQuery = "SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE (enddate IS NULL OR enddate = '' OR enddate = '0000-00-00 00:00:00') AND status = 'active' AND user_id = '" . $user_ID . "' LIMIT 1";
        $blank = $wpdb->get_var($sqlQuery);
        if (empty($blank)) {
            //null out the expiration
            $sqlQuery = "UPDATE {$wpdb->pmpro_memberships_users} SET enddate = NULL WHERE status = 'active' AND membership_id = '" . intval($_REQUEST['membership_level']) . "' AND user_id = '" . $user_ID . "' LIMIT 1";
            if ($wpdb->query($sqlQuery)) {
                $expiration_changed = true;
            }
        }
    }
    //emails if there was a change
    if (!empty($level_changed) || !empty($expiration_changed)) {
        //email to admin
        $pmproemail = new PMProEmail();
        if (!empty($expiration_changed)) {
            $pmproemail->expiration_changed = true;
        }
        $pmproemail->sendAdminChangeAdminEmail(get_userdata($user_ID));
        //send email
        if (!empty($_REQUEST['send_admin_change_email'])) {
            //email to member
            $pmproemail = new PMProEmail();
            if (!empty($expiration_changed)) {
                $pmproemail->expiration_changed = true;
            }
            $pmproemail->sendAdminChangeEmail(get_userdata($user_ID));
        }
    }
}
开发者ID:nwmcinc,项目名称:paid-memberships-pro,代码行数:74,代码来源:profile.php

示例15: cancel

 /**
  * Cancel an order and call the cancel step of the gateway class if needed.
  */
 function cancel()
 {
     //only need to cancel on the gateway if there is a subscription id
     if (empty($this->subscription_transaction_id)) {
         //just mark as cancelled
         $this->updateStatus("cancelled");
         return true;
     } else {
         //cancel the gateway subscription first
         $result = $this->Gateway->cancel($this);
         if ($result == false) {
             //there was an error, but cancel the order no matter what
             $this->updateStatus("cancelled");
             //we should probably notify the admin
             $pmproemail = new PMProEmail();
             $pmproemail->template = "subscription_cancel_error";
             $pmproemail->data = array("body" => "<p>" . sprintf(__("There was an error canceling the subscription for user with ID=%s. You will want to check your payment gateway to see if their subscription is still active.", "pmpro"), strval($this->user_id)) . "</p><p>Error: " . $this->error . "</p>");
             $pmproemail->data["body"] .= "<p>Associated Order:<br />" . nl2br(var_export($this, true)) . "</p>";
             $pmproemail->sendEmail(get_bloginfo("admin_email"));
             return false;
         } else {
             //Note: status would have been set to cancelled by the gateway class. So we don't have to update it here.
             //remove billing numbers in pmpro_memberships_users if the membership is still active
             global $wpdb;
             $sqlQuery = "UPDATE {$wpdb->pmpro_memberships_users} SET initial_payment = 0, billing_amount = 0, cycle_number = 0 WHERE user_id = '" . $this->user_id . "' AND membership_id = '" . $this->membership_id . "' AND status = 'active'";
             $wpdb->query($sqlQuery);
             return $result;
         }
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:33,代码来源:class.memberorder.php


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