• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP give_get_payment_meta_user_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_data

 /**
  * Get the Export Data.
  *
  * @access public
  * @since 1.5
  * @global object $wpdb Used to query the database using the WordPress database API.
  * @return array $data The data for the CSV file.
  */
 public function get_data()
 {
     global $wpdb;
     $data = array();
     $args = array('number' => 30, 'page' => $this->step, 'status' => $this->status);
     if (!empty($this->start) || !empty($this->end)) {
         $args['date_query'] = array(array('after' => date('Y-n-d 00:00:00', strtotime($this->start)), 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), 'inclusive' => true));
     }
     //echo json_encode($args ); exit;
     $payments = give_get_payments($args);
     if ($payments) {
         foreach ($payments as $payment) {
             $payment_meta = give_get_payment_meta($payment->ID);
             $user_info = give_get_payment_meta_user_info($payment->ID);
             $total = give_get_payment_amount($payment->ID);
             $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
             $products = '';
             $skus = '';
             if (is_numeric($user_id)) {
                 $user = get_userdata($user_id);
             } else {
                 $user = false;
             }
             $data[] = array('id' => $payment->ID, 'seq_id' => give_get_payment_number($payment->ID), 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', 'skus' => $skus, 'amount' => html_entity_decode(give_format_amount($total)), 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), 'trans_id' => give_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'give'), 'status' => give_get_payment_status($payment, true));
         }
         $data = apply_filters('give_export_get_data', $data);
         $data = apply_filters('give_export_get_data_' . $this->export_type, $data);
         return $data;
     }
     return false;
 }
开发者ID:wordimpress,项目名称:give,代码行数:39,代码来源:class-batch-export-payments.php


示例2: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since  1.0
  * @global object $wpdb Used to query the database using the WordPress
  *                      Database API
  * @return array $data The data for the CSV file
  */
 public function get_data()
 {
     global $wpdb, $give_options;
     $data = array();
     $payments = give_get_payments(array('offset' => 0, 'number' => -1, 'mode' => give_is_test_mode() ? 'test' : 'live', 'status' => isset($_POST['give_export_payment_status']) ? $_POST['give_export_payment_status'] : 'any', 'month' => isset($_POST['month']) ? absint($_POST['month']) : date('n'), 'year' => isset($_POST['year']) ? absint($_POST['year']) : date('Y')));
     foreach ($payments as $payment) {
         $payment_meta = give_get_payment_meta($payment->ID);
         $user_info = give_get_payment_meta_user_info($payment->ID);
         $total = give_get_payment_amount($payment->ID);
         $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
         $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '';
         $form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
         if (is_numeric($user_id)) {
             $user = get_userdata($user_id);
         } else {
             $user = false;
         }
         $data[] = array('id' => $payment->ID, 'seq_id' => give_get_payment_number($payment->ID), 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', 'amount' => html_entity_decode(give_format_amount($total)), 'form_id' => $form_id, 'form' => $form_title, 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), 'trans_id' => give_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'give'), 'status' => give_get_payment_status($payment, true));
     }
     $data = apply_filters('give_export_get_data', $data);
     $data = apply_filters('give_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:lots0logs,项目名称:Give,代码行数:32,代码来源:class-export-payments.php


示例3: get_recent_donations

 /**
  * Retrieves Recent Sales
  *
  * @access public
  * @since  1.1
  * @return array
  */
 public function get_recent_donations()
 {
     global $wp_query;
     $sales = array();
     if (!user_can($this->user_id, 'view_give_reports') && !$this->override) {
         return $sales;
     }
     if (isset($wp_query->query_vars['id'])) {
         $query = array();
         $query[] = give_get_payment_by('id', $wp_query->query_vars['id']);
     } elseif (isset($wp_query->query_vars['purchasekey'])) {
         $query = array();
         $query[] = give_get_payment_by('key', $wp_query->query_vars['purchasekey']);
     } elseif (isset($wp_query->query_vars['email'])) {
         $query = give_get_payments(array('meta_key' => '_give_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     } else {
         $query = give_get_payments(array('number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     }
     if ($query) {
         $i = 0;
         foreach ($query as $payment) {
             $payment_meta = give_get_payment_meta($payment->ID);
             $user_info = give_get_payment_meta_user_info($payment->ID);
             $first_name = isset($user_info['first_name']) ? $user_info['first_name'] : '';
             $last_name = isset($user_info['last_name']) ? $user_info['last_name'] : '';
             $sales['donations'][$i]['ID'] = give_get_payment_number($payment->ID);
             $sales['donations'][$i]['transaction_id'] = give_get_payment_transaction_id($payment->ID);
             $sales['donations'][$i]['key'] = give_get_payment_key($payment->ID);
             $sales['donations'][$i]['total'] = give_get_payment_amount($payment->ID);
             $sales['donations'][$i]['gateway'] = give_get_payment_gateway($payment->ID);
             $sales['donations'][$i]['name'] = $first_name . ' ' . $last_name;
             $sales['donations'][$i]['fname'] = $first_name;
             $sales['donations'][$i]['lname'] = $last_name;
             $sales['donations'][$i]['email'] = give_get_payment_user_email($payment->ID);
             $sales['donations'][$i]['date'] = $payment->post_date;
             $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : $payment_meta;
             $price = isset($payment_meta['form_id']) ? give_get_form_price($payment_meta['form_id']) : false;
             $price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
             $sales['donations'][$i]['form']['id'] = $form_id;
             $sales['donations'][$i]['form']['name'] = get_the_title($payment_meta['form_id']);
             $sales['donations'][$i]['form']['price'] = $price;
             if (give_has_variable_prices($form_id)) {
                 if (isset($payment_meta['price_id'])) {
                     $price_name = give_get_price_option_name($form_id, $payment_meta['price_id'], $payment->ID);
                     $sales['donations'][$i]['form']['price_name'] = $price_name;
                     $sales['donations'][$i]['form']['price_id'] = $price_id;
                     $sales['donations'][$i]['form']['price'] = give_get_price_option_amount($form_id, $price_id);
                 }
             }
             //Add custom meta to API
             foreach ($payment_meta as $meta_key => $meta_value) {
                 $exceptions = array('form_title', 'form_id', 'price_id', 'user_info', 'key', 'email', 'date');
                 //Don't clutter up results with dupes
                 if (in_array($meta_key, $exceptions)) {
                     continue;
                 }
                 $sales['donations'][$i]['payment_meta'][$meta_key] = $meta_value;
             }
             $i++;
         }
     }
     return apply_filters('give_api_donations_endpoint', $sales);
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:70,代码来源:class-give-api.php


示例4: give_email_tag_billing_address

/**
 * Email template tag: billing_address
 * The donor's billing address
 *
 * @param int $payment_id
 *
 * @return string billing_address
 */
function give_email_tag_billing_address($payment_id)
{
    $user_info = give_get_payment_meta_user_info($payment_id);
    $user_address = !empty($user_info['address']) ? $user_info['address'] : array('line1' => '', 'line2' => '', 'city' => '', 'country' => '', 'state' => '', 'zip' => '');
    $return = $user_address['line1'] . "\n";
    if (!empty($user_address['line2'])) {
        $return .= $user_address['line2'] . "\n";
    }
    $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n";
    $return .= $user_address['country'];
    return $return;
}
开发者ID:wordimpress,项目名称:give,代码行数:20,代码来源:class-give-email-tags.php


示例5: wp_die

    wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give'));
}
// Setup the variables
$payment_id = absint($_GET['id']);
$number = give_get_payment_number($payment_id);
$item = get_post($payment_id);
// Sanity check... fail if purchase ID is invalid
if (!is_object($item) || $item->post_type != 'give_payment') {
    wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give'));
}
$payment_meta = give_get_payment_meta($payment_id);
$transaction_id = esc_attr(give_get_payment_transaction_id($payment_id));
$user_id = give_get_payment_user_id($payment_id);
$donor_id = give_get_payment_customer_id($payment_id);
$payment_date = strtotime($item->post_date);
$user_info = give_get_payment_meta_user_info($payment_id);
$address = !empty($user_info['address']) ? $user_info['address'] : array('line1' => '', 'line2' => '', 'city' => '', 'country' => '', 'state' => '', 'zip' => '');
$gateway = give_get_payment_gateway($payment_id);
$currency_code = give_get_payment_currency_code($payment_id);
?>
<div class="wrap give-wrap">
	<h2><?php 
printf(__('Payment %s', 'give'), $number);
?>
</h2>
	<?php 
do_action('give_view_order_details_before', $payment_id);
?>
	<form id="give-edit-order-form" method="post">
		<?php 
do_action('give_view_order_details_form_top', $payment_id);
开发者ID:lots0logs,项目名称:Give,代码行数:31,代码来源:view-order-details.php


示例6: get_post

/**
 * This template is used to display the purchase summary with [give_receipt]
 */
global $give_receipt_args, $give_options, $payment;
//Validation: Ensure $payment var is set
if (empty($payment) && isset($give_receipt_args['id'])) {
    $payment = get_post($give_receipt_args['id']);
}
//Double-Validation: Check for $payment global
if (empty($payment)) {
    give_output_error(__('The specified receipt ID appears to be invalid', 'give'));
    return;
}
$meta = give_get_payment_meta($payment->ID);
$donation = $meta['form_title'];
$user = give_get_payment_meta_user_info($payment->ID);
$email = give_get_payment_user_email($payment->ID);
$status = give_get_payment_status($payment, true);
?>

<?php 
do_action('give_payment_receipt_before_table', $payment, $give_receipt_args);
?>

	<table id="give_donation_receipt" class="give-table">
		<thead>
		<?php 
do_action('give_payment_receipt_before', $payment, $give_receipt_args);
?>

		<?php 
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:31,代码来源:shortcode-receipt.php


示例7: get_logs

 /**
  * Gets the log entries for the current view
  *
  * @access public
  * @since  1.0
  * @global object $give_logs Give Logs Object
  * @return array $logs_data Array of all the Log entires
  */
 public function get_logs()
 {
     global $give_logs;
     // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
     wp_suspend_cache_addition(true);
     $logs_data = array();
     $paged = $this->get_paged();
     $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null;
     $user = $this->get_filtered_user();
     $log_query = array('post_parent' => $give_form, 'log_type' => 'sale', 'paged' => $paged, 'meta_query' => $this->get_meta_query());
     $logs = $give_logs->get_connected_logs($log_query);
     if ($logs) {
         foreach ($logs as $log) {
             $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
             // Make sure this payment hasn't been deleted
             if (get_post($payment_id)) {
                 $user_info = give_get_payment_meta_user_info($payment_id);
                 $payment_meta = give_get_payment_meta($payment_id);
                 $payment_amount = give_get_payment_amount($payment_id);
                 $logs_data[] = array('ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', 'payment_id' => $payment_id, 'form' => $log->post_parent, 'amount' => $payment_amount, 'user_id' => $user_info['id'], 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], 'date' => get_post_field('post_date', $payment_id));
             }
         }
     }
     return $logs_data;
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:33,代码来源:class-sales-logs-list-table.php


示例8: get_payments

 /**
  * Retrieve payments.
  *
  * The query can be modified in two ways; either the action before the
  * query is run, or the filter on the arguments (existing mainly for backwards
  * compatibility).
  *
  * @access public
  * @since  1.0
  * @return object
  */
 public function get_payments()
 {
     do_action('give_pre_get_payments', $this);
     $query = new WP_Query($this->args);
     if ('payments' != $this->args['output']) {
         return $query->posts;
     }
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $details = new stdClass();
             $payment_id = get_post()->ID;
             $details->ID = $payment_id;
             $details->date = get_post()->post_date;
             $details->post_status = get_post()->post_status;
             $details->total = give_get_payment_amount($payment_id);
             $details->fees = give_get_payment_fees($payment_id);
             $details->key = give_get_payment_key($payment_id);
             $details->gateway = give_get_payment_gateway($payment_id);
             $details->user_info = give_get_payment_meta_user_info($payment_id);
             if (give_get_option('enable_sequential')) {
                 $details->payment_number = give_get_payment_number($payment_id);
             }
             $this->payments[] = apply_filters('give_payment', $details, $payment_id, $this);
         }
         wp_reset_postdata();
     }
     do_action('give_post_get_payments', $this);
     return $this->payments;
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:41,代码来源:class-payments-query.php


示例9: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since  1.0
  * @global object $wpdb      Used to query the database using the WordPress Database API
  * @global object $give_logs Give Logs Object
  * @return array $data The data for the CSV file
  */
 public function get_data()
 {
     global $wpdb;
     $data = array();
     if (!empty($_POST['give_export_download'])) {
         // Export donors of a specific product
         global $give_logs;
         $args = array('post_parent' => absint($_POST['give_export_download']), 'log_type' => 'sale', 'nopaging' => true);
         if (isset($_POST['give_price_option'])) {
             $args['meta_query'] = array(array('key' => '_give_log_price_id', 'value' => (int) $_POST['give_price_option']));
         }
         $logs = $give_logs->get_connected_logs($args);
         if ($logs) {
             foreach ($logs as $log) {
                 $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
                 $user_info = give_get_payment_meta_user_info($payment_id);
                 $data[] = array('first_name' => $user_info['first_name'], 'last_name' => $user_info['last_name'], 'email' => $user_info['email'], 'date' => $log->post_date);
             }
         }
     } else {
         // Export all donors
         $donors = Give()->customers->get_customers(array('number' => -1));
         $i = 0;
         foreach ($donors as $donor) {
             if ('emails' != $_POST['give_export_option']) {
                 $data[$i]['name'] = $donor->name;
             }
             $data[$i]['email'] = $donor->email;
             if ('full' == $_POST['give_export_option']) {
                 $data[$i]['purchases'] = $donor->purchase_count;
                 $data[$i]['amount'] = give_format_amount($donor->purchase_value);
             }
             $i++;
         }
     }
     $data = apply_filters('give_export_get_data', $data);
     $data = apply_filters('give_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:48,代码来源:class-export-customers.php


示例10: give_offline_send_admin_notice

/**
 * Send Offline Donation Admin Notice
 *
 * @description Sends a notice to site admins about the pending donation
 *
 * @since       1.0
 *
 * @param int $payment_id
 *
 * @return void
 *
 */
function give_offline_send_admin_notice($payment_id = 0)
{
    /* Send an email notification to the admin */
    $admin_email = give_get_admin_notice_emails();
    $user_info = give_get_payment_meta_user_info($payment_id);
    if (isset($user_info['id']) && $user_info['id'] > 0) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_data->display_name;
    } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
        $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
    } else {
        $name = $user_info['email'];
    }
    $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
    $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
    $admin_message = __('Dear Admin,', 'give') . "\n\n" . __('An offline donation has been made', 'give') . ".\n\n";
    $order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id);
    $admin_message .= __('Donor: ', 'give') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
    $admin_message .= __('Amount: ', 'give') . " " . html_entity_decode($amount, ENT_COMPAT, 'UTF-8') . "\n\n";
    $admin_message .= __('There is a new pending donation awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give') . "\n\n";
    $admin_message .= sprintf(__('View Donation Details: %s.', 'give'), $order_url) . "\n\n";
    $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
    $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
    $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
    wp_mail($admin_email, $admin_subject, $admin_message, $admin_headers, $attachments);
}
开发者ID:joedolson,项目名称:Give,代码行数:38,代码来源:offline-donations.php


示例11: give_clear_user_history_cache

/**
 * Flushes the current user's purchase history transient when a payment status
 * is updated
 *
 * @since 1.0
 *
 * @param $payment_id
 * @param $new_status the status of the payment, probably "publish"
 * @param $old_status the status of the payment prior to being marked as "complete", probably "pending"
 */
function give_clear_user_history_cache($payment_id, $new_status, $old_status)
{
    $user_info = give_get_payment_meta_user_info($payment_id);
    delete_transient('give_user_' . $user_info['id'] . '_purchases');
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:15,代码来源:actions.php


示例12: get_recent_donations

 /**
  * Retrieves Recent Sales
  *
  * @access public
  * @since  1.1
  * @return array
  */
 public function get_recent_donations()
 {
     global $wp_query;
     $sales = array();
     if (!user_can($this->user_id, 'view_give_reports') && !$this->override) {
         return $sales;
     }
     if (isset($wp_query->query_vars['id'])) {
         $query = array();
         $query[] = give_get_payment_by('id', $wp_query->query_vars['id']);
     } elseif (isset($wp_query->query_vars['purchasekey'])) {
         $query = array();
         $query[] = give_get_payment_by('key', $wp_query->query_vars['purchasekey']);
     } elseif (isset($wp_query->query_vars['email'])) {
         $query = give_get_payments(array('meta_key' => '_give_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     } else {
         $query = give_get_payments(array('number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     }
     if ($query) {
         $i = 0;
         foreach ($query as $payment) {
             $payment_meta = give_get_payment_meta($payment->ID);
             $user_info = give_get_payment_meta_user_info($payment->ID);
             $sales['donations'][$i]['ID'] = give_get_payment_number($payment->ID);
             $sales['donations'][$i]['transaction_id'] = give_get_payment_transaction_id($payment->ID);
             $sales['donations'][$i]['key'] = give_get_payment_key($payment->ID);
             $sales['donations'][$i]['total'] = give_get_payment_amount($payment->ID);
             $sales['donations'][$i]['gateway'] = give_get_payment_gateway($payment->ID);
             $sales['donations'][$i]['email'] = give_get_payment_user_email($payment->ID);
             $sales['donations'][$i]['date'] = $payment->post_date;
             $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : $payment_meta;
             $price = isset($payment_meta['form_id']) ? give_get_form_price($payment_meta['form_id']) : false;
             $price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
             $sales['donations'][$i]['form']['id'] = $form_id;
             $sales['donations'][$i]['form']['name'] = get_the_title($payment_meta['form_id']);
             $sales['donations'][$i]['form']['price'] = $price;
             if (give_has_variable_prices($form_id)) {
                 if (isset($payment_meta['price_id'])) {
                     $price_name = give_get_price_option_name($form_id, $payment_meta['price_id'], $payment->ID);
                     $sales['donations'][$i]['form']['price_name'] = $price_name;
                     $sales['donations'][$i]['form']['price'] = give_get_price_option_amount($form_id, $price_id);
                 }
             }
             $i++;
         }
     }
     return $sales;
 }
开发者ID:pantelicnevena,项目名称:newhanan,代码行数:55,代码来源:class-give-api.php


示例13: give_update_payment_details

/**
 *
 * Process the payment details edit
 *
 * @access      private
 *
 * @param $data
 *
 * @since       1.0
 * @return      void
 *
 */
function give_update_payment_details($data)
{
    if (!current_user_can('edit_give_payments', $data['give_payment_id'])) {
        wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
    }
    check_admin_referer('give_update_payment_details_nonce');
    // Retrieve the payment ID
    $payment_id = absint($data['give_payment_id']);
    // Retrieve existing payment meta
    $meta = give_get_payment_meta($payment_id);
    $user_info = give_get_payment_meta_user_info($payment_id);
    $status = $data['give-payment-status'];
    $user_id = isset($data['give-payment-user-id']) ? intval($data['give-payment-user-id']) : '';
    $date = sanitize_text_field($data['give-payment-date']);
    $hour = sanitize_text_field($data['give-payment-time-hour']);
    $form_id = give_get_payment_form_id($payment_id);
    // Restrict to our high and low
    if ($hour > 23) {
        $hour = 23;
    } elseif ($hour < 0) {
        $hour = 00;
    }
    $minute = sanitize_text_field($data['give-payment-time-min']);
    // Restrict to our high and low
    if ($minute > 59) {
        $minute = 59;
    } elseif ($minute < 0) {
        $minute = 00;
    }
    $address = array_map('trim', $data['give-payment-address'][0]);
    $date = date('Y-m-d', strtotime($date)) . ' ' . $hour . ':' . $minute . ':00';
    $curr_total = give_sanitize_amount(give_get_payment_amount($payment_id));
    $new_total = give_sanitize_amount($_POST['give-payment-total']);
    $curr_customer_id = sanitize_text_field($data['give-current-customer']);
    $new_customer_id = sanitize_text_field($data['customer-id']);
    do_action('give_update_edited_purchase', $payment_id);
    // Update main payment record
    $updated = wp_update_post(array('ID' => $payment_id, 'edit_date' => true, 'post_date' => $date));
    if (0 === $updated) {
        wp_die(esc_attr__('Error Updating Payment', 'give'), esc_attr__('Error', 'give'), array('response' => 400));
    }
    $customer_changed = false;
    if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
        $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
        $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
        if (empty($email) || empty($names)) {
            wp_die(esc_attr__('New Customers require a name and email address', 'give'));
        }
        $customer = new Give_Customer($email);
        if (empty($customer->id)) {
            $customer_data = array('name' => $names, 'email' => $email);
            $user_id = email_exists($email);
            if (false !== $user_id) {
                $customer_data['user_id'] = $user_id;
            }
            if (!$customer->create($customer_data)) {
                // Failed to crete the new customer, assume the previous customer
                $customer_changed = false;
                $customer = new Give_Customer($curr_customer_id);
                give_set_error('give-payment-new-customer-fail', __('Error creating new customer', 'give'));
            }
        }
        $new_customer_id = $customer->id;
        $previous_customer = new Give_Customer($curr_customer_id);
        $customer_changed = true;
    } elseif ($curr_customer_id !== $new_customer_id) {
        $customer = new Give_Customer($new_customer_id);
        $email = $customer->email;
        $names = $customer->name;
        $previous_customer = new Give_Customer($curr_customer_id);
        $customer_changed = true;
    } else {
        $customer = new Give_Customer($curr_customer_id);
        $email = $customer->email;
        $names = $customer->name;
    }
    // Setup first and last name from input values
    $names = explode(' ', $names);
    $first_name = !empty($names[0]) ? $names[0] : '';
    $last_name = '';
    if (!empty($names[1])) {
        unset($names[0]);
        $last_name = implode(' ', $names);
    }
    if ($customer_changed) {
        // Remove the stats and payment from the previous customer and attach it to the new customer
        $previous_customer->remove_payment($payment_id, false);
        $customer->attach_payment($payment_id, false);
//.........这里部分代码省略.........
开发者ID:lots0logs,项目名称:Give,代码行数:101,代码来源:actions.php


示例14: give_offline_send_admin_notice

/**
 * Send Offline Donation Admin Notice
 *
 * Sends a notice to site admins about the pending donation
 *
 * @since       1.0
 *
 * @param int $payment_id
 *
 * @return void
 *
 */
function give_offline_send_admin_notice($payment_id = 0)
{
    /* Send an email notification to the admin */
    $admin_email = give_get_admin_notice_emails();
    $user_info = give_get_payment_meta_user_info($payment_id);
    if (isset($user_info['id']) && $user_info['id'] > 0) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_data->display_name;
    } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
        $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
    } else {
        $name = $user_info['email'];
    }
    $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
    $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
    $admin_message = esc_attr__('Dear Admin,', 'give') . "\n\n";
    $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give') . get_bloginfo('name') . ' ';
    $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give') . "\n\n";
    $admin_message .= '<strong>' . esc_attr__('Donor: ', 'give') . '</strong>' . '{fullname}' . "\n";
    $admin_message .= '<strong>' . esc_attr__('Amount: ', 'give') . '</strong>' . '{amount}' . "\n\n";
    $admin_message .= sprintf('<a href="%1$s">%2$s</a>', admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id), esc_html__('Click Here to View and/or Update Donation Details', 'give')) . "\n\n";
    $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
    $admin_message = give_do_email_tags($admin_message, $payment_id);
    $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
    $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
    //Send Email
    $emails = Give()->emails;
    if (!empty($admin_headers)) {
        $emails->__set('headers', $admin_headers);
    }
    $emails->send($admin_email, $admin_subject, $admin_message, $attachments);
}
开发者ID:wordimpress,项目名称:give,代码行数:44,代码来源:offline-donations.php


示例15: get_zip

 public function get_zip()
 {
     $zip = null;
     $user_info = give_get_payment_meta_user_info($this->donation_id);
     if (!empty($user_info['address'])) {
         $zip = $user_info['address']['zip'];
     }
     return $zip;
 }
开发者ID:wp-pay-extensions,项目名称:give,代码行数:9,代码来源:PaymentData.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP give_get_payment_number函数代码示例发布时间:2022-05-15
下一篇:
PHP give_get_payment_meta函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap