本文整理汇总了PHP中give_get_payment_user_email函数的典型用法代码示例。如果您正苦于以下问题:PHP give_get_payment_user_email函数的具体用法?PHP give_get_payment_user_email怎么用?PHP give_get_payment_user_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了give_get_payment_user_email函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: column_default
/**
* This function renders most of the columns in the list table.
*
* @access public
* @since 1.0
*
* @param array $item Contains all the data of the discount code
* @param string $column_name The name of the column
*
* @return string Column Name
*/
public function column_default($item, $column_name)
{
switch ($column_name) {
case 'form':
return '<a href="' . esc_url(add_query_arg('form', $item[$column_name])) . '" >' . get_the_title($item[$column_name]) . '</a>';
case 'user_id':
return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&user=' . (!empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))) . '">' . $item['user_name'] . '</a>';
case 'amount':
return give_currency_filter(give_format_amount($item['amount']));
case 'payment_id':
return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . give_get_payment_number($item['payment_id']) . '</a>';
default:
return $item[$column_name];
}
}
示例2: column_default
/**
* This function renders most of the columns in the list table.
*
* @access public
* @since 1.0
*
* @param array $item Contains all the data of the discount code
* @param string $column_name The name of the column
*
* @return string Column Name
*/
public function column_default($item, $column_name)
{
$payment = give_get_payment_by('id', $item['payment_id']);
switch ($column_name) {
case 'form':
return '<a href="' . esc_url(add_query_arg('form', $item[$column_name])) . '" >' . get_the_title($item[$column_name]) . '</a>';
case 'user_id':
return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&user=' . (!empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))) . '">' . $item['user_name'] . '</a>';
case 'amount':
return give_currency_filter(give_format_amount($item['amount']));
case 'status':
$value = '<div class="give-donation-status status-' . sanitize_title(give_get_payment_status($payment, true)) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status($payment, true) . '</div>';
if ($payment->mode == 'test') {
$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__('This payment was made in test mode', 'give') . '">' . esc_html__('Test', 'give') . '</span>';
}
return $value;
case 'payment_id':
return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . give_get_payment_number($item['payment_id']) . '</a>';
default:
return $item[$column_name];
}
}
示例3: give_email_donation_receipt
/**
* Email the payment confirmation to the buyer in a customizable Donation Receipt
*
* @since 1.0
*
* @param int $payment_id Payment ID
* @param bool $admin_notice Whether to send the admin email notification or not (default: true)
*
* @return void
*/
function give_email_donation_receipt($payment_id, $admin_notice = true)
{
$payment_data = give_get_payment_meta($payment_id);
$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
$to_email = give_get_payment_user_email($payment_id);
$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
$subject = give_do_email_tags($subject, $payment_id);
$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
$message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
$emails = Give()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', __('Donation Receipt', 'give'));
$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
$emails->__set('headers', $headers);
$emails->send($to_email, $subject, $message, $attachments);
if ($admin_notice && !give_admin_notices_disabled($payment_id)) {
do_action('give_admin_sale_notice', $payment_id, $payment_data);
}
}
示例4: 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);
}
示例5: give_can_view_receipt
/**
* Determines the receipt visibility status
*
* @since 1.3.2
*
* @param string $payment_key
*
* @return bool Whether the receipt is visible or not.
*/
function give_can_view_receipt($payment_key = '')
{
$return = false;
if (empty($payment_key)) {
return $return;
}
global $give_receipt_args;
$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
$payment_meta = give_get_payment_meta($give_receipt_args['id']);
if (is_user_logged_in()) {
if ($user_id === (int) get_current_user_id()) {
$return = true;
} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
$return = true;
} elseif (current_user_can('view_give_sensitive_data')) {
$return = true;
}
}
$session = give_get_purchase_session();
if (!empty($session) && !is_user_logged_in()) {
if ($session['purchase_key'] === $payment_meta['key']) {
$return = true;
}
}
return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
}
示例6: give_get_donation_notification_body_content
/**
* Sale Notification Template Body
*
* @since 1.0
*
* @param int $payment_id Payment ID
* @param array $payment_data Payment Data
*
* @return string $email_body Body of the email
*/
function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array())
{
global $give_options;
$user_info = maybe_unserialize($payment_data['user_info']);
$email = give_get_payment_user_email($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 = $email;
}
$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
$default_email_body = __('Hello', 'give') . "\n\n" . __('A donation has been made', 'give') . ".\n\n";
$default_email_body .= sprintf(__('%s sold:', 'give'), give_get_forms_label_plural()) . "\n\n";
$default_email_body .= __('Donor: ', 'give') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
$default_email_body .= __('Amount: ', 'give') . " " . html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8') . "\n";
$default_email_body .= __('Payment Method: ', 'give') . " " . $gateway . "\n\n";
$default_email_body .= __('Thank you', 'give');
$email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body;
$email_body = give_do_email_tags($email, $payment_id);
return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
}
示例7: _e
_e('Transaction ID:', 'give');
?>
</span>
<span><?php
echo apply_filters('give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id);
?>
</span>
</p>
</div>
<?php
}
?>
<div class="give-admin-box-inside">
<p><?php
$purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr(give_get_payment_user_email($payment_id)));
?>
<a href="<?php
echo $purchase_url;
?>
"><?php
_e('View all donations for this donor', 'give');
?>
»</a>
</p>
</div>
<?php
do_action('give_view_order_details_payment_meta_after', $payment_id);
?>
示例8: give_email_tag_user_email
/**
* Email template tag: user_email
* The donor's email address
*
* @param int $payment_id
*
* @return string user_email
*/
function give_email_tag_user_email($payment_id)
{
return give_get_payment_user_email($payment_id);
}
示例9: 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
if (filter_var($give_receipt_args['payment_id'], FILTER_VALIDATE_BOOLEAN)) {
示例10: get_donor
/**
* Get donor html.
*
* @access public
* @since 1.0
*
* @param Give_Payment $payment Contains all the data of the payment
*
* @return string Data shown in the User column
*/
public function get_donor($payment)
{
$customer_id = give_get_payment_customer_id($payment->ID);
if (!empty($customer_id)) {
$customer = new Give_Customer($customer_id);
$value = '<a href="' . esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$customer_id}")) . '">' . $customer->name . '</a>';
} else {
$email = give_get_payment_user_email($payment->ID);
$value = '<a href="' . esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s={$email}")) . '">' . esc_html__('(donor missing)', 'give') . '</a>';
}
return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
}
示例11: give_offline_send_donor_instructions
/**
* Send Offline Donation Instructions
*
* @description Sends a notice to the donor with offline instructions; can be customized per form
*
* @param int $payment_id
*
* @since 1.0
* @return void
*/
function give_offline_send_donor_instructions($payment_id = 0)
{
$payment_data = give_get_payment_meta($payment_id);
$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
//Customize email content depending on whether the single form has been customized
$email_content = give_get_option('global_offline_donation_email');
if ($post_offline_customization_option === 'yes') {
$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
}
$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
$to_email = give_get_payment_user_email($payment_id);
$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
if ($post_offline_customization_option === 'yes') {
$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
}
$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
$subject = give_do_email_tags($subject, $payment_id);
$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
$message = give_do_email_tags($email_content, $payment_id);
$emails = Give()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', __('Offline Donation Instructions', 'give'));
$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
$emails->__set('headers', $headers);
$emails->send($to_email, $subject, $message, $attachments);
}
示例12: give_process_paypal_web_accept_and_cart
/**
* Process web accept (one time) payment IPNs
*
* @since 1.0
*
* @param array $data IPN Data
*
* @return void
*/
function give_process_paypal_web_accept_and_cart($data, $payment_id)
{
if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
return;
}
if (empty($payment_id)) {
return;
}
// Collect payment details
$purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
$paypal_amount = $data['mc_gross'];
$payment_status = strtolower($data['payment_status']);
$currency_code = strtolower($data['mc_currency']);
$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
$payment_meta = give_get_payment_meta($payment_id);
if (give_get_payment_gateway($payment_id) != 'paypal') {
return;
// this isn't a PayPal standard IPN
}
// Verify payment recipient
if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
give_update_payment_status($payment_id, 'failed');
give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
return;
}
// Verify payment currency
if ($currency_code != strtolower($payment_meta['currency'])) {
give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
give_update_payment_status($payment_id, 'failed');
give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
return;
}
if (!give_get_payment_user_email($payment_id)) {
// No email associated with purchase, so store from PayPal
give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
// Setup and store the donors's details
$address = array();
$address['line1'] = !empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
$address['city'] = !empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
$address['state'] = !empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
$address['country'] = !empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
$address['zip'] = !empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
$user_info = array('id' => '-1', 'email' => sanitize_text_field($data['payer_email']), 'first_name' => sanitize_text_field($data['first_name']), 'last_name' => sanitize_text_field($data['last_name']), 'discount' => '', 'address' => $address);
$payment_meta['user_info'] = $user_info;
give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
}
if ($payment_status == 'refunded' || $payment_status == 'reversed') {
// Process a refund
give_process_paypal_refund($data, $payment_id);
} else {
if (get_post_status($payment_id) == 'publish') {
return;
// Only complete payments once
}
// Retrieve the total purchase amount (before PayPal)
$payment_amount = give_get_payment_amount($payment_id);
if (number_format((double) $paypal_amount, 2) < number_format((double) $payment_amount, 2)) {
// The prices don't match
give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
give_update_payment_status($payment_id, 'failed');
give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
return;
}
if ($purchase_key != give_get_payment_key($payment_id)) {
// Purchase keys don't match
give_record_gateway_error(__('IPN Error', 'give'), sprintf(__('Invalid purchase key in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
give_update_payment_status($payment_id, 'failed');
give_insert_payment_note($payment_id, __('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
return;
}
if ($payment_status == 'completed' || give_is_test_mode()) {
give_insert_payment_note($payment_id, sprintf(__('PayPal Transaction ID: %s', 'give'), $data['txn_id']));
give_set_payment_transaction_id($payment_id, $data['txn_id']);
give_update_payment_status($payment_id, 'publish');
} else {
if ('pending' == $payment_status && isset($data['pending_reason'])) {
// Look for possible pending reasons, such as an echeck
$note = '';
switch (strtolower($data['pending_reason'])) {
case 'echeck':
$note = __('Payment made via eCheck and will clear automatically in 5-8 days', 'give');
break;
case 'address':
$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal', 'give');
break;
case 'intl':
$note = __('Payment must be accepted manually through PayPal due to international account regulations', 'give');
break;
case 'multi-currency':
$note = __('Payment received in non-shop currency and must be accepted manually through PayPal', 'give');
//.........这里部分代码省略.........
示例13: 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;
}
示例14: give_get_payment_user_id
/**
* Get the user ID associated with a payment
*
* @since 1.3
*
* @param int $payment_id Payment ID
*
* @return string $user_id User ID
*/
function give_get_payment_user_id($payment_id)
{
$user_id = -1;
// check the customer record first
$customer_id = give_get_payment_customer_id($payment_id);
$customer = new Give_Customer($customer_id);
if (!empty($customer->user_id) && $customer->user_id > 0) {
$user_id = $customer->user_id;
}
// check the payment meta if we're still not finding a user with the customer record
if (empty($user_id) || $user_id < 1) {
$payment_meta_user_id = give_get_payment_meta($payment_id, '_give_payment_user_id', true);
if (!empty($payment_meta_user_id)) {
$user_id = $payment_meta_user_id;
}
}
// Last ditch effort is to connect payment email with a user in the user table
if (empty($user_id) || $user_id < 1) {
$payment_email = give_get_payment_user_email($payment_id);
$user = get_user_by('email', $payment_email);
if (false !== $user) {
$user_id = $user->ID;
}
}
return apply_filters('give_payment_user_id', (int) $user_id);
}
示例15: give_get_payment_meta
/**
* Get Payment Meta for a specific Payment
*
* @since 1.0
*
* @param int $payment_id Payment ID
* @param string $meta_key The meta key to pull
* @param bool $single Pull single meta entry or as an object
*
* @return mixed $meta Payment Meta
*/
function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true)
{
$meta = get_post_meta($payment_id, $meta_key, $single);
if ($meta_key === '_give_payment_meta') {
if (empty($meta['key'])) {
$meta['key'] = give_get_payment_key($payment_id);
}
if (empty($meta['email'])) {
$meta['email'] = give_get_payment_user_email($payment_id);
}
if (empty($meta['date'])) {
$meta['date'] = get_post_field('post_date', $payment_id);
}
}
$meta = apply_filters('give_get_payment_meta_' . $meta_key, $meta, $payment_id);
return apply_filters('give_get_payment_meta', $meta, $payment_id, $meta_key);
}