/** * This function renders most of the columns in the list table. * * @access public * @since 1.4 * * @param array $item Contains all the data of the log item * @param string $column_name The name of the column * * @return string Column Name */ public function column_default($item, $column_name) { switch ($column_name) { case 'download': return '<a href="' . add_query_arg('download', $item[$column_name]) . '" >' . get_the_title($item[$column_name]) . '</a>'; case 'user_id': return '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&user='******'user_id'])) . '">' . $item['user_name'] . '</a>'; case 'amount': return edd_currency_filter(edd_format_amount($item['amount'])); case 'payment_id': return '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . edd_get_payment_number($item['payment_id']) . '</a>'; default: return $item[$column_name]; } }
/** * Email template tag: payment_id * The unique ID number for this purchase * * @since 1.0.0 * @param int $payment_id * @return int payment_id */ function edd_wallet_email_tag_payment_id($payment_id) { if (get_post_type($payment_id) == 'edd_payment') { return edd_get_payment_number($payment_id); } else { return ''; } }
function edd_userpro_embed_profile_fields($hook_args) { if (!current_user_can('edit_user', $hook_args['user_id'])) { return; } echo '<div class="userpro-section userpro-column userpro-collapsible-1 userpro-collapsed-1">' . __('Purchase History', 'edd-userpro-embed') . '</div>'; echo '<div class="userpro-field userpro-field-edd-purchase-history userpro-field-view" data-key="edd-purchase-history">'; $purchases = edd_get_users_purchases($hook_args['user_id'], 99999, true, 'any'); if ($purchases) { do_action('edd_before_purchase_history'); ?> <table id="edd_user_history"> <thead> <tr class="edd_purchase_row"> <?php do_action('edd_purchase_history_header_before'); ?> <th class="edd_purchase_id"><?php _e('ID', 'easy-digital-downloads'); ?> </th> <th class="edd_purchase_date"><?php _e('Date', 'easy-digital-downloads'); ?> </th> <th class="edd_purchase_amount"><?php _e('Amount', 'easy-digital-downloads'); ?> </th> <th class="edd_purchase_details"><?php _e('Details', 'easy-digital-downloads'); ?> </th> <?php do_action('edd_purchase_history_header_after'); ?> </tr> </thead> <?php foreach ($purchases as $post) { setup_postdata($post); ?> <?php $purchase_data = edd_get_payment_meta($post->ID); ?> <tr class="edd_purchase_row"> <?php do_action('edd_purchase_history_row_start', $post->ID, $purchase_data); ?> <td class="edd_purchase_id">#<?php echo edd_get_payment_number($post->ID); ?> </td> <td class="edd_purchase_date"><?php echo date_i18n(get_option('date_format'), strtotime(get_post_field('post_date', $post->ID))); ?> </td> <td class="edd_purchase_amount"> <span class="edd_purchase_amount"><?php echo edd_currency_filter(edd_format_amount(edd_get_payment_amount($post->ID))); ?> </span> </td> <td class="edd_purchase_details"> <?php if ($post->post_status != 'publish') { ?> <span class="edd_purchase_status <?php echo $post->post_status; ?> "><?php echo edd_get_payment_status($post, true); ?> </span> <a href="<?php echo esc_url(add_query_arg('payment_key', edd_get_payment_key($post->ID), edd_get_success_page_uri())); ?> ">»</a> <?php } else { ?> <a href="<?php echo esc_url(add_query_arg('payment_key', edd_get_payment_key($post->ID), edd_get_success_page_uri())); ?> "><?php _e('View Details', 'edd-userpro-embed'); ?> </a> <?php } ?> </td> <?php do_action('edd_purchase_history_row_end', $post->ID, $purchase_data); ?> </tr> <?php } ?> </table> <?php do_action('edd_after_purchase_history'); ?> <?php wp_reset_postdata(); ?> <?php } else { ?> <p class="edd-no-purchases"><?php _e('You have not made any purchases', 'edd-userpro-embed'); ?> </p> <?php } echo '</div>'; }
/** * Gets the next available order number * * This is used when inserting a new payment * * @since 2.0 * @return string $number The next available payment number */ function edd_get_next_payment_number() { if (!edd_get_option('enable_sequential')) { return false; } $number = get_option('edd_last_payment_number'); $start = edd_get_option('sequential_start', 1); $increment_number = true; if (false !== $number) { if (empty($number)) { $number = $start; $increment_number = false; } } else { // This case handles the first addition of the new option, as well as if it get's deleted for any reason $payments = new EDD_Payments_Query(array('number' => 1, 'order' => 'DESC', 'orderby' => 'ID', 'output' => 'posts', 'fields' => 'ids')); $last_payment = $payments->get_payments(); if ($last_payment) { $number = edd_get_payment_number($last_payment[0]); } if (!empty($number) && $number !== $last_payment[0]) { $number = edd_remove_payment_prefix_postfix($number); } else { $number = $start; $increment_number = false; } } $increment_number = apply_filters('edd_increment_payment_number', $increment_number, $number); if ($increment_number) { $number++; } return apply_filters('edd_get_next_payment_number', $number); }
/** * Retrieves Recent Sales * * @access public * @since 1.5 * @return array */ public function get_recent_sales() { global $wp_query; $sales = array(); if( ! user_can( $this->user_id, 'view_shop_reports' ) && ! $this->override ) { return $sales; } if( isset( $wp_query->query_vars['id'] ) ) { $query = array(); $query[] = edd_get_payment_by( 'id', $wp_query->query_vars['id'] ); } elseif( isset( $wp_query->query_vars['purchasekey'] ) ) { $query = array(); $query[] = edd_get_payment_by( 'key', $wp_query->query_vars['purchasekey'] ); } elseif( isset( $wp_query->query_vars['email'] ) ) { $query = edd_get_payments( array( 'meta_key' => '_edd_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish' ) ); } else { $query = edd_get_payments( array( 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish' ) ); } if ( $query ) { $i = 0; foreach ( $query as $payment ) { $payment_meta = edd_get_payment_meta( $payment->ID ); $user_info = edd_get_payment_meta_user_info( $payment->ID ); $cart_items = edd_get_payment_meta_cart_details( $payment->ID ); $sales['sales'][ $i ]['ID'] = edd_get_payment_number( $payment->ID ); $sales['sales'][ $i ]['transaction_id'] = edd_get_payment_transaction_id( $payment->ID ); $sales['sales'][ $i ]['key'] = edd_get_payment_key( $payment->ID ); $sales['sales'][ $i ]['discount'] = isset( $user_info['discount'] ) && $user_info['discount'] != 'none' ? explode( ',', $user_info['discount'] ) : array(); $sales['sales'][ $i ]['subtotal'] = edd_get_payment_subtotal( $payment->ID ); $sales['sales'][ $i ]['tax'] = edd_get_payment_tax( $payment->ID ); $sales['sales'][ $i ]['fees'] = edd_get_payment_fees( $payment->ID ); $sales['sales'][ $i ]['total'] = edd_get_payment_amount( $payment->ID ); $sales['sales'][ $i ]['gateway'] = edd_get_payment_gateway( $payment->ID ); $sales['sales'][ $i ]['email'] = edd_get_payment_user_email( $payment->ID ); $sales['sales'][ $i ]['date'] = $payment->post_date; $sales['sales'][ $i ]['products'] = array(); $c = 0; foreach ( $cart_items as $key => $item ) { $item_id = isset( $item['id'] ) ? $item['id'] : $item; $price = isset( $item['price'] ) ? $item['price'] : false; $price_id = isset( $item['item_number']['options']['price_id'] ) ? $item['item_number']['options']['price_id'] : null; $quantity = isset( $item['quantity'] ) && $item['quantity'] > 0 ? $item['quantity'] : 1; if( ! $price ) { // This function is only used on payments with near 1.0 cart data structure $price = edd_get_download_final_price( $item_id, $user_info, null ); } $price_name = ''; if ( isset( $item['item_number'] ) && isset( $item['item_number']['options'] ) ) { $price_options = $item['item_number']['options']; if ( isset( $price_options['price_id'] ) ) { $price_name = edd_get_price_option_name( $item['id'], $price_options['price_id'], $payment->ID ); } } $sales['sales'][ $i ]['products'][ $c ]['quantity'] = $quantity; $sales['sales'][ $i ]['products'][ $c ]['name'] = get_the_title( $item['id'] ); $sales['sales'][ $i ]['products'][ $c ]['price'] = $price; $sales['sales'][ $i ]['products'][ $c ]['price_name'] = $price_name; $c++; } $i++; } } return $sales; }
<?php } ?> <?php } ?> </td> <td> <a href="<?php echo esc_url(edd_get_success_page_url('?payment_key=' . edd_get_payment_key($payment_id))); ?> " title="<?php esc_attr_e('View Purchase Record', 'edd_sl'); ?> ">#<?php echo edd_get_payment_number($payment_id); ?> </a> </td> <?php do_action('edd_sl_license_keys_row_end', $license->ID); ?> </tr> <?php } ?> <?php } else { ?> <tr class="edd_sl_license_row"> <?php
/** * Render the ID column * * @access public * @since 2.0 * @param array $payment Contains all the data for the checkbox column * @return string Displays a checkbox */ public function column_ID($payment) { return edd_get_payment_number($payment->ID); }
// Exit if accessed directly if (!defined('ABSPATH')) { exit; } /** * View Order Details Page * * @since 1.6 * @return void */ if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { wp_die(__('Payment ID not supplied. Please try again', 'edd'), __('Error', 'edd')); } // Setup the variables $payment_id = absint($_GET['id']); $number = edd_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 != 'edd_payment') { wp_die(__('The specified ID does not belong to a payment. Please try again', 'edd'), __('Error', 'edd')); } $payment_meta = edd_get_payment_meta($payment_id); $transaction_id = esc_attr(edd_get_payment_transaction_id($payment_id)); $cart_items = edd_get_payment_meta_cart_details($payment_id); $user_id = edd_get_payment_user_id($payment_id); $customer_id = edd_get_payment_customer_id($payment_id); $payment_date = strtotime($item->post_date); $unlimited = edd_payment_has_unlimited_downloads($payment_id); $user_info = edd_get_payment_meta_user_info($payment_id); $address = !empty($user_info['address']) ? $user_info['address'] : array('line1' => '', 'line2' => '', 'city' => '', 'country' => '', 'state' => '', 'zip' => ''); $gateway = edd_get_payment_gateway($payment_id);
<h2>You do not have permission to view this licence</h2> <?php } else { ?> <h2>Generate OSGi Licence</h2> <?php if (isset($edd_payment_post_id)) { ?> <p> <a href="<?php echo add_query_arg('payment_key', edd_get_payment_key($edd_payment_post_id), edd_get_success_page_uri()); ?> ">Link to Payment Receipt: <?php echo edd_get_payment_number($edd_payment_post_id); ?> </a> <p> <?php } ?> <h2>Licence Metadata</h2> <form method="post" action="" enctype="multipart/form-data"> <?php echo $eddOsgiLicences->licenceMetadataForm($osgilicenceMetadata, $osgilicenceMetadataSpec, $noEditMetadata); if ($noEditMetadata == TRUE) { ?>
/** * 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.8 * @return object */ public function get_payments() { do_action('edd_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 = edd_get_payment_amount($payment_id); $details->subtotal = edd_get_payment_subtotal($payment_id); $details->tax = edd_get_payment_tax($payment_id); $details->fees = edd_get_payment_fees($payment_id); $details->key = edd_get_payment_key($payment_id); $details->gateway = edd_get_payment_gateway($payment_id); $details->user_info = edd_get_payment_meta_user_info($payment_id); $details->cart_details = edd_get_payment_meta_cart_details($payment_id, true); if (edd_get_option('enable_sequential')) { $details->payment_number = edd_get_payment_number($payment_id); } $this->payments[] = apply_filters('edd_payment', $details, $payment_id, $this); } wp_reset_postdata(); } do_action('edd_post_get_payments', $this); return $this->payments; }
function edd_downloads_change_the_title($title, $sep) { $post = get_post($sep); if ($post->post_content == '[purchase_history]' && $post->post_title == 'My Orders' && esc_html($_REQUEST['action']) == 'manage_licenses') { $title = __('Downloads for order #', 'edd_downloads') . edd_get_payment_number(absint($_REQUEST['payment_id'])); } return $title; }
/** * This function renders most of the columns in the list table. * * @access public * @since 1.4 * * @param array $item Contains all the data of the log item * @param string $column_name The name of the column * * @return string Column Name */ public function column_default($item, $column_name) { $return = ''; switch ($column_name) { case 'download': $return = '<a href="' . add_query_arg('download', $item[$column_name]) . '" >' . get_the_title($item[$column_name]) . '</a>'; break; case 'user_id': $user = !empty($item['user_id']) ? $item['user_id'] : edd_get_payment_user_email($item['payment_id']); $return = '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&user='******'">' . $item['user_name'] . '</a>'; break; case 'item_price': $return = edd_currency_filter(edd_format_amount($item['item_price'])); break; case 'amount': $return = edd_currency_filter(edd_format_amount($item['amount'] / $item['quantity'])); break; case 'payment_id': $return = '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . edd_get_payment_number($item['payment_id']) . '</a>'; break; default: $return = $item[$column_name]; break; } return $return; }
/** * Slackedd Notification Codes * * @since 1.0.0 */ function slackedd_notification($payment_id) { $edd_options = edd_get_settings(); /* Check that the user has all required information added for the plugin to work */ $enable_slack = isset($edd_options['slackedd_enable_notification']) ? $edd_options['slackedd_enable_notification'] : ''; $hide_order_number = isset($edd_options['slackedd_hide_order_number']) ? $edd_options['slackedd_hide_order_number'] : ''; $hide_order_items = isset($edd_options['slackedd_hide_order_items']) ? $edd_options['slackedd_hide_order_items'] : ''; $hide_payment_gateway = isset($edd_options['slackedd_hide_payment_gateway']) ? $edd_options['slackedd_hide_payment_gateway'] : ''; $hide_buyer_information = isset($edd_options['slackedd_hide_buyer_information']) ? $edd_options['slackedd_hide_buyer_information'] : ''; $slack_channel = isset($edd_options['slackedd_channel']) ? $edd_options['slackedd_channel'] : ''; $webhook_url = isset($edd_options['slackedd_webhook_url']) ? $edd_options['slackedd_webhook_url'] : ''; if (!($enable_slack && $slack_channel && $webhook_url)) { return; } $enable_slack = isset($edd_options['slackedd_enable_notification']) ? $edd_options['slackedd_enable_notification'] : ''; $emoji = !empty($edd_options['slackedd_icon_emoji']) ? $edd_options['slackedd_icon_emoji'] : ':moneybag:'; $bot_name = !empty($edd_options['slackedd_bot_name']) ? $edd_options['slackedd_bot_name'] : 'Slackedd'; $order_amount = esc_attr(edd_format_amount(edd_get_payment_amount($payment_id))); $currency_symbol = edd_currency_symbol($payment_meta['currency']); $currency_symbol = html_entity_decode($currency_symbol, ENT_QUOTES, 'UTF-8'); $payment_meta = edd_get_payment_meta($payment_id); $cart_items = edd_get_payment_meta_cart_details($payment_id); $items_sold = ''; $order_id = edd_get_payment_number($payment_id); foreach ($cart_items as $key => $cart_item) { $name = $cart_item['name']; $price = $cart_item['price']; $items_sold .= "*Name:* " . $name . " | *Price:* " . $currency_symbol . "" . $price . " \n"; } $gateway = edd_get_payment_gateway($payment_id); $payment_method = edd_get_gateway_admin_label($gateway); $user_data = $payment_meta['user_info']; /* Display the new sale introduction */ $message = "A new sale has occurred at " . get_bloginfo('name') . " \n\n"; /* Show or hide order number based on user preference in settings page */ if (!$hide_order_number) { $message .= "*Order* <" . get_bloginfo('home') . "/wp-admin/edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=" . $order_id . "|#" . $order_id . "> \n"; } /* Show the order total */ $message .= "*Order Total:* " . $currency_symbol . "" . $order_amount . " \n\n"; /* Show or hide payment gateway based on user preference in settings page */ if (!$hide_payment_gateway) { $message .= "*Payment Method:* " . $payment_method . " \n\n"; } /* Show or hide order items based on user preference in settings page */ if (!$hide_order_items) { $message .= "*" . edd_get_cart_quantity() . " ITEM(S):* \n"; $message .= $items_sold; } /* Show or hide order number based on user preference in settings page */ if (!$hide_buyer_information) { $message .= "\n\n *Customer:* " . $user_data['first_name'] . " " . $user_data['last_name'] . " " . $user_data['email'] . "\n"; } $attachment = array(); $attachment[] = array('color' => 'good', 'fallback' => 'New sale notification of ' . $currency_symbol . '' . $price . ' at ' . get_bloginfo('name'), 'mrkdwn_in' => array('text'), 'text' => $message, 'title' => 'New Sale Notification!'); $payload = array('attachments' => $attachment, 'channel' => $slack_channel, 'icon_emoji' => $emoji, 'username' => $bot_name); $args = array('body' => json_encode($payload), 'timeout' => 30); $response = wp_remote_post($webhook_url, $args); return; }
/** * Get the Export Data * * @access public * @since 2.4 * @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 H:i:s', strtotime($this->start)), 'before' => date('Y-n-d H:i:s', strtotime($this->end)), 'inclusive' => true)); } //echo json_encode($args ); exit; $payments = edd_get_payments($args); if ($payments) { foreach ($payments as $payment) { $payment_meta = edd_get_payment_meta($payment->ID); $user_info = edd_get_payment_meta_user_info($payment->ID); $downloads = edd_get_payment_meta_cart_details($payment->ID); $total = edd_get_payment_amount($payment->ID); $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email']; $products = ''; $skus = ''; if ($downloads) { foreach ($downloads as $key => $download) { // Download ID $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; // If the download has variable prices, override the default price $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; $price = edd_get_download_final_price($id, $user_info, $price_override); // Display the Downoad Name $products .= get_the_title($id) . ' - '; if (edd_use_skus()) { $sku = edd_get_download_sku($id); if (!empty($sku)) { $skus .= $sku; } } if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) { $price_options = $downloads[$key]['item_number']['options']; if (isset($price_options['price_id'])) { $products .= edd_get_price_option_name($id, $price_options['price_id'], $payment->ID) . ' - '; } } $products .= html_entity_decode(edd_currency_filter($price)); if ($key != count($downloads) - 1) { $products .= ' / '; if (edd_use_skus()) { $skus .= ' / '; } } } } if (is_numeric($user_id)) { $user = get_userdata($user_id); } else { $user = false; } $data[] = array('id' => $payment->ID, 'seq_id' => edd_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'] : '', 'products' => $products, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_format_amount(edd_get_payment_tax($payment->ID, $payment_meta))), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'edd'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'trans_id' => edd_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'edd'), 'status' => edd_get_payment_status($payment, true)); } $data = apply_filters('edd_export_get_data', $data); $data = apply_filters('edd_export_get_data_' . $this->export_type, $data); return $data; } return false; }
/** * Displays upgraded to / from indicators * * @since 3.3 * @return void */ function edd_sl_payment_details_inner_upgrade_history($payment_id = 0) { $upgraded_from = get_post_meta($payment_id, '_edd_sl_upgraded_payment_id', true); $upgraded_to = get_post_meta($payment_id, '_edd_sl_upgraded_to_payment_id', true); if ($upgraded_from) { $view_url = esc_url(admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=') . $upgraded_from); ?> <div class="edd-admin-box-inside"> <p> <?php printf(__('<strong>Upgraded from:</strong> <a href="%s">#%s</a>', 'edd_sl'), $view_url, edd_get_payment_number($upgraded_from)); ?> </p> </div> <?php } if ($upgraded_to) { $view_url = esc_url(admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=') . $upgraded_to); ?> <div class="edd-admin-box-inside"> <p> <?php printf(__('<strong>Upgraded to:</strong> <a href="%s">#%s</a>', 'edd_sl'), $view_url, edd_get_payment_number($upgraded_to)); ?> </p> </div> <?php } }
/** * This function renders most of the columns in the list table. * * @access public * @since 1.4 * * @param array $item Contains all the data of the log item * @param string $column_name The name of the column * * @return string Column Name */ public function column_default($item, $column_name) { switch ($column_name) { case 'download': return '<a href="' . add_query_arg('download', $item[$column_name]) . '" >' . get_the_title($item[$column_name]) . '</a>'; case 'user_id': return $item[$column_name] ? '<a href="' . add_query_arg('user', $item[$column_name]) . '">' . $item['user_name'] . '</a>' : $item['user_name']; case 'payment_id': return $item['payment_id'] !== false ? '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . edd_get_payment_number($item['payment_id']) . '</a>' : ''; default: return $item[$column_name]; } }
/** * Email template tag: payment_id * The unique ID number for this purchase * * @param int $payment_id * * @return int payment_id */ function edd_email_tag_payment_id($payment_id) { return edd_get_payment_number($payment_id); }
/** * Get order ID * * @return string */ public function get_order_id() { /* * Check if the 'edd_get_payment_number' function exists, it was added in Easy Digital Downloads version 2.0. * * @since 1.2.0 * @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/2.4.3/includes/payments/functions.php#L1178-L1204 */ if (function_exists('edd_get_payment_number')) { return edd_get_payment_number($this->payment_id); } else { return $this->payment_id; } }
/** * Gets the next available order number * * This is used when inserting a new payment * * @since 2.0 * @return string $number The next available payment number */ function edd_get_next_payment_number() { if (!edd_get_option('enable_sequential')) { return false; } $prefix = edd_get_option('sequential_prefix'); $postfix = edd_get_option('sequential_postfix'); $start = edd_get_option('sequential_start', 1); $payments = new EDD_Payments_Query(array('number' => 1, 'order' => 'DESC', 'orderby' => 'ID', 'output' => 'posts', 'fields' => 'ids')); $last_payment = $payments->get_payments(); if ($last_payment) { $number = edd_get_payment_number($last_payment[0]); if (empty($number)) { $number = $prefix . $start . $postfix; } else { // Remove prefix and postfix $number = str_replace($prefix, '', $number); $number = str_replace($postfix, '', $number); // Ensure it's a whole number $number = intval($number); // Increment the payment number $number++; // Re-add the prefix and postfix $number = $prefix . $number . $postfix; } } else { $number = $prefix . $start . $postfix; } return apply_filters('edd_get_next_payment_number', $number); }
<table id="edd_purchase_receipt"> <thead> <?php do_action('edd_payment_receipt_before', $payment, $edd_receipt_args); ?> <?php if ($edd_receipt_args['payment_id']) { ?> <tr> <th><strong><?php _e('Payment', 'easy-digital-downloads'); ?> :</strong></th> <th><?php echo edd_get_payment_number($payment->ID); ?> </th> </tr> <?php } ?> </thead> <tbody> <tr> <td class="edd_receipt_payment_status"><strong><?php _e('Payment Status', 'easy-digital-downloads'); ?> :</strong></td>
/** * This function renders most of the columns in the list table. * * @access public * @since 1.4 * * @param array $item Contains all the data of the log item * @param string $column_name The name of the column * * @return string Column Name */ public function column_default($item, $column_name) { $return = ''; $currency = $item['currency']; switch ($column_name) { case 'download': $download_id = $item[$column_name]; $download = new EDD_Download($download_id); $title = $download->post_title; if (edd_has_variable_prices($download->ID)) { $price_id = $item['price_id']; if (!is_null($price_id) && !empty($download->prices[$price_id])) { $title .= ' — ' . $download->prices[$price_id]['name']; } } $return = '<a href="' . add_query_arg('download', $item[$column_name]) . '" >' . $title . '</a>'; break; case 'user_id': $user = !empty($item['user_id']) ? $item['user_id'] : edd_get_payment_user_email($item['payment_id']); $return = '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&user='******'">' . $item['user_name'] . '</a>'; break; case 'item_price': $return = edd_currency_filter(edd_format_amount($item['item_price']), $currency); break; case 'amount': $return = edd_currency_filter(edd_format_amount($item['amount'] / $item['quantity']), $currency); break; case 'payment_id': $return = '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . edd_get_payment_number($item['payment_id']) . '</a>'; break; default: $return = $item[$column_name]; break; } return $return; }