/** * Displays a Manage Licenses link in purchase history * * @since 2.7 */ function edd_sl_site_management_links($payment_id, $purchase_data) { $licensing = edd_software_licensing(); $downloads = edd_get_payment_meta_downloads($payment_id); if ($downloads) { $manage_licenses_url = esc_url(add_query_arg(array('action' => 'manage_licenses', 'payment_id' => $payment_id))); echo '<td class="edd_license_key">'; if (edd_is_payment_complete($payment_id)) { echo '<a href="' . esc_url($manage_licenses_url) . '">' . __('View Licenses', 'edd_sl') . '</a>'; } else { echo '-'; } echo '</td>'; } }
?> </div> <?php if ($edd_receipt_args['notes']) { ?> <div class="edd_purchase_receipt_product_notes"><?php echo wpautop(edd_get_product_notes($item['id'])); ?> </div> <?php } ?> <?php if (edd_is_payment_complete($payment->ID) && edd_receipt_show_download_files($item['id'], $edd_receipt_args, $item)) { ?> <ul class="edd_purchase_receipt_files"> <?php if (!empty($download_files) && is_array($download_files)) { foreach ($download_files as $filekey => $file) { $download_url = edd_get_download_file_url($meta['key'], $email, $filekey, $item['id'], $price_id); ?> <li class="edd_download_file"> <a href="<?php echo esc_url($download_url); ?> " class="edd_download_file_link"><?php echo edd_get_file_name($file); ?> </a>
/** * Render the Email Column * * @access public * @since 1.4 * @param array $payment Contains all the data of the payment * @return string Data shown in the Email column */ public function column_email($payment) { $row_actions = array(); $email = edd_get_payment_user_email($payment->ID); // Add search term string back to base URL $search_terms = isset($_GET['s']) ? trim($_GET['s']) : ''; if (!empty($search_terms)) { $this->base_url = add_query_arg('s', $search_terms, $this->base_url); } if (edd_is_payment_complete($payment->ID) && !empty($email)) { $row_actions['email_links'] = '<a href="' . add_query_arg(array('edd-action' => 'email_links', 'purchase_id' => $payment->ID), $this->base_url) . '">' . __('Resend Purchase Receipt', 'easy-digital-downloads') . '</a>'; } $row_actions['delete'] = '<a href="' . wp_nonce_url(add_query_arg(array('edd-action' => 'delete_payment', 'purchase_id' => $payment->ID), $this->base_url), 'edd_payment_nonce') . '">' . __('Delete', 'easy-digital-downloads') . '</a>'; $row_actions = apply_filters('edd_payment_row_actions', $row_actions, $payment); if (empty($email)) { $email = __('(unknown)', 'easy-digital-downloads'); } $value = $email . $this->row_actions($row_actions); return apply_filters('edd_payments_table_column', $value, $payment->ID, 'email'); }
<?php } ?> <span class="price-text"><?php echo edd_currency_filter(edd_format_amount($price), $currency_code); ?> </span> </li> <li class="actions"> <input type="hidden" class="edd-payment-details-download-has-log" name="edd-payment-details-downloads[<?php echo $key; ?> ][has_log]" value="1" /> <?php if (edd_get_download_files($item_id, $price_id) && edd_is_payment_complete($payment_id)) { ?> <a href="" class="edd-copy-download-link" data-download-id="<?php echo esc_attr($item_id); ?> " data-price-id="<?php echo esc_attr($price_id); ?> "><?php _e('Copy Download Link(s)', 'edd'); ?> </a> | <?php } ?> <a href="" class="edd-order-remove-download edd-delete" data-key="<?php
/** * * @param unknown $payment * @param string $edd_receipt_args */ public function edd_osgi_action_payment_receipt_after_table($payment, $edd_receipt_args = null) { if ($this->osgipub_osgi_debug) { echo "<p>debug: this is the action after table</p>\n"; } if (isset($payment) && edd_is_payment_complete($payment->ID)) { $meta = get_post_meta($payment->ID); if ($this->osgipub_osgi_debug) { echo "<p>debug: Payment vardump="; var_dump($payment); echo "</p>\n"; echo "<p>debug: Payment metadata vardump="; var_dump($meta); echo "</p>\n"; } // same $cart = edd_get_payment_meta_cart_details( $payment->ID, true ); $downloads = edd_get_payment_meta_cart_details($payment->ID, true); $edd_payment_post_id = $payment->ID; $edd_payment_user_id = (string) $meta['_edd_payment_user_id'][0]; $edd_payment_customer_id = (string) $meta['_edd_payment_customer_id'][0]; //TODO REMOVED BECAUSE NOT BEING GENERATED $edd_payment_number = ( string ) $meta ['_edd_payment_number'] [0]; $edd_payment_number = $edd_payment_post_id; $edd_payment_purchase_key = (string) $meta['_edd_payment_purchase_key'][0]; // see easy-digital-downloads/templates/history-downloads.php // add_query_arg( 'payment_key', edd_get_payment_key( $post->ID ), edd_get_success_page_uri() ) if ($downloads) { $display_licence_table = false; // check if any downloads are osgi licenced foreach ($downloads as $download) { if ($this->is_osgi_licenced($download['id'])) { $display_licence_table = true; } } if ($display_licence_table) { echo "<div id=\"osgi_licence_list_table\" class=\"osgi_licence_list\">\n"; echo "<h3>OSGi Licences</h3>\n"; echo "<p>One of more of your purchased downloads have associated OSGi Licences.<BR>To generate your licences select the links below.</p>\n"; echo "<table>\n"; } // used to set change licence name for multiple downloads $download_no = 0; foreach ($downloads as $download) { // Skip over Bundles. Products included with a bundle will be displayed individually if (edd_is_bundled_product($download['id'])) { continue; } // if not osgi licenced bundle skip if (!$this->is_osgi_licenced($download['id'])) { continue; } $download_no++; $price_id = edd_get_cart_item_price_id($download); $download_files = edd_get_download_files($download['id'], $price_id); $name = get_the_title($download['id']); // quantity used to handle multiple licences per download for ($quantity = 1; $quantity <= $download['quantity']; $quantity++) { if (isset($edd_payment_number)) { // start of table row echo " <tr>\n"; echo " <td>\n"; // product id string from download // contains maven unique id of product to which this licence applies $edd_osgiProductIdStr = get_post_meta($download['id'], '_edd_osgiProductIdStr', true); // try loading modified LicenceMetadataSpecStr from this product efinition and apply to licence post $edd_modified_osgiLicenceMetadataSpecStr = get_post_meta($download['id'], '_edd_modified_osgiLicenceMetadataSpecStr', true); // Retrieve and append the price option name if (!empty($price_id)) { $name .= ' - ' . edd_get_price_option_name($download['id'], $price_id, $payment->ID); } // product name - payment number - download number $licence_post_title = $name . ' - ' . $edd_payment_number . '-' . $download_no . '-' . $quantity; // remove whitepsace $licence_post_name = preg_replace('/\\s+/', '', $licence_post_title); if ($this->osgipub_osgi_debug) { echo "<p>debug: download [id]=" . $download['id'] . '</p>\\n'; if (!isset($edd_osgiProductIdStr)) { echo "<p>debug: from download edd_osgiProductIdStr not set for download [id]=" . $download['id'] . '</p>\\n'; } else { echo "<p>debug: from download edd_osgiProductIdStr="; echo $edd_osgiProductIdStr; echo "</p>\n"; } echo "<p>debug: payment name="; echo $name; echo "</p>\n"; echo "<p>debug: licence_post_title="; echo $licence_post_title; echo "</p>\n"; echo "<p>debug: licence_post_name="; echo $licence_post_name; echo "</p>\n"; echo "<p>debug: edd_payment_number="; echo $edd_payment_number; echo "</p>\n"; } $found_post = null; if ($posts = get_posts(array('name' => $licence_post_name, 'post_type' => 'osgi_licence_post', 'post_status' => 'publish', 'posts_per_page' => 1))) { $found_post = $posts[0]; } // Now, we can do something with $found_post if (!is_null($found_post)) { if ($this->osgipub_osgi_debug) { echo "<p>debug: we found the licence post="; echo $found_post->ID; echo "</p>\n"; } echo '<a href="' . get_post_permalink($found_post->ID) . '" >Link to Licence: ' . $licence_post_title . '</a>'; echo "\n"; } else { // get post with payment number metadata OR create post with metadata $post = array('post_content' => '<p>DO NOT EDIT: You can only view or change this licence post by using View Post.</p>', 'post_name' => $licence_post_name, 'post_title' => $licence_post_title, 'post_status' => 'publish', 'post_type' => 'osgi_licence_post', 'ping_status' => 'closed', 'comment_status' => 'closed'); // Default is the option 'default_comment_status', or 'closed'. // 'post_category' => [ array(<category id>, ...) ] // Default empty. // 'tags_input' => [ '<tag>, <tag>, ...' | array ] // Default empty. // 'tax_input' => [ array( <taxonomy> => <array | string> ) ] // For custom taxonomies. Default empty. // 'page_template' => '../edd-downloads-as-osgi.php' // Requires name of template file, eg template.php. Default empty. $newpost_id = wp_insert_post($post); // setting product id for licence // update_post_meta ( $newpost_id, 'edd_osgiProductIdStr', 'org.opennms.co.uk/org.opennms.co.uk.newfeature/0.0.1-SNAPSHOT' ); update_post_meta($newpost_id, 'edd_osgiProductIdStr', $edd_osgiProductIdStr); // apply modified metadata to this licence post update_post_meta($newpost_id, '_edd_modified_osgiLicenceMetadataSpecStr', $edd_modified_osgiLicenceMetadataSpecStr); // setting customer metadata - not yet used in the template update_post_meta($newpost_id, 'edd_payment_customer_id', $edd_payment_customer_id); update_post_meta($newpost_id, 'edd_payment_user_id', $edd_payment_user_id); // setting edd_osgiLicencee information $f_name = (string) get_user_meta($edd_payment_user_id, 'first_name', true); $first_name = isset($f_name) ? $f_name : ""; $l_name = (string) get_user_meta($edd_payment_user_id, 'last_name', true); $last_name = isset($l_name) ? $l_name : ""; $address = ""; $addr = edd_get_customer_address($edd_payment_user_id); if (isset($addr)) { $address = implode(", ", $addr); } $edd_osgiLicencee = $first_name . ", " . $last_name . ", " . $address; update_post_meta($newpost_id, 'edd_osgiLicencee', $edd_osgiLicencee); // for reverse lookup of post id of the associated payment update_post_meta($newpost_id, 'edd_payment_post_id', $edd_payment_post_id); if ($this->osgipub_osgi_debug) { echo "<p>debug: we created a new licence post="; echo $newpost_id; echo "</p>\n"; } echo '<a href="' . get_post_permalink($newpost_id) . '" >Link to Licence: ' . $licence_post_title . '</a>'; echo "\n"; } echo " </td>\n"; echo " </tr>\n"; } } } if ($display_licence_table) { echo "</table>\n"; echo "</div> <!-- div id=osgi_licence_list_table -->"; } } } else { echo '<p>payment not set</p>\\n'; } if ($this->osgipub_osgi_debug) { if (isset($edd_receipt_args)) { echo "<p>debug: edd_receipt_args vardump="; var_dump($edd_receipt_args); echo "</p>\n"; } else { echo '<p>debug: edd_receipt_args not set</p>\\n'; } } }
/** * Instruct EDD PDF Invoices that subscription paymentsare eligible for Invoices * * @since 2.2 * @return bool */ public function is_invoice_allowed($ret, $payment_id) { $payment_status = get_post_status($payment_id); if ('edd_subscription' == $payment_status) { $parent = get_post_field('post_parent', $payment_id); if (edd_is_payment_complete($parent)) { $ret = true; } } return $ret; }
/** * Render the Email Column * * @access public * @since 1.4 * @param array $item Contains all the data of the payment * @return string Data shown in the Email column */ public function column_email($item) { $payment = get_post($item['ID']); $row_actions = array(); $row_actions['edit'] = '<a href="' . add_query_arg(array('edd-action' => 'edit-payment', 'purchase_id' => $payment->ID), $this->base_url) . '">' . __('Edit', 'edd') . '</a>'; if (edd_is_payment_complete($payment->ID)) { $row_actions['email_links'] = '<a href="' . add_query_arg(array('edd-action' => 'email_links', 'purchase_id' => $payment->ID), $this->base_url) . '">' . __('Resend Purchase Receipt', 'edd') . '</a>'; } $row_actions['delete'] = '<a href="' . wp_nonce_url(add_query_arg(array('edd-action' => 'delete_payment', 'purchase_id' => $payment->ID), $this->base_url), 'edd_payment_nonce') . '">' . __('Delete', 'edd') . '</a>'; $row_actions = apply_filters('edd_payment_row_actions', $row_actions, $payment); $value = $item['email'] . $this->row_actions($row_actions); return apply_filters('edd_payments_table_column', $value, $item['ID'], 'email'); }
//print_r($cart); exit; if ($licenses) { ?> <?php foreach ($cart as $cart_row => $cart_item) { ?> <?php if (empty($cart_item['in_bundle'])) { $price_id = edd_get_cart_item_price_id($cart_item); $download_files = edd_get_download_files($cart_item['id'], $price_id); $products_domains = edd_software_licensing()->get_sites($licenses[$cart_row]->ID); if (edd_is_payment_complete($payment_id)) { //&& edd_receipt_show_download_files( $cart_item['id'], $edd_receipt_args ) ?> <?php if ($download_files && is_array($download_files)) { foreach ($download_files as $filekey => $file) { $post_meta = get_post_meta($licenses[$cart_row]->ID, '_edd_sl_download_id', true); $product = get_post($file['attachment_id']); if (!empty($product)) { $license_date = get_post_meta($licenses[$cart_row]->ID, '_edd_sl_expiration', true); $unlimited_license = get_post_meta($cart_item['id'], '_unlimited_license', true); $now = strtotime(date('Y-m-d H:i:s')); $expired_license = $license_date > $now || $unlimited_license == 1 ? 0 : 1; if (1 === $expired_license) { ?>
if (!empty($price_id)) { $name .= ' - ' . edd_get_price_option_name($download['id'], $price_id, $payment->ID); } do_action('edd_download_history_row_start', $payment->ID, $download['id']); ?> <td class="edd_download_download_name"><?php echo esc_html($name); ?> </td> <?php if (!edd_no_redownload()) { ?> <td class="edd_download_download_files"> <?php if (edd_is_payment_complete($payment->ID)) { if ($download_files) { foreach ($download_files as $filekey => $file) { $download_url = edd_get_download_file_url($purchase_data['key'], $email, $filekey, $download['id'], $price_id); ?> <div class="edd_download_file"> <a href="<?php echo esc_url($download_url); ?> " class="edd_download_file_link"> <?php echo edd_get_file_name($file); ?> </a> </div>
/** * Render the Email Column * * @access public * @since 1.4 * @param array $payment Contains all the data of the payment * @return string Data shown in the Email column */ public function column_email($payment) { $row_actions = array(); if (edd_is_payment_complete($payment->ID)) { $row_actions['email_links'] = '<a href="' . add_query_arg(array('edd-action' => 'email_links', 'purchase_id' => $payment->ID), $this->base_url) . '">' . __('Resend Purchase Receipt', 'edd') . '</a>'; } $row_actions['delete'] = '<a href="' . wp_nonce_url(add_query_arg(array('edd-action' => 'delete_payment', 'purchase_id' => $payment->ID), $this->base_url), 'edd_payment_nonce') . '">' . __('Delete', 'edd') . '</a>'; $row_actions = apply_filters('edd_payment_row_actions', $row_actions, $payment); $email = edd_get_payment_user_email($payment->ID); if (empty($email)) { $payment->user_info['email'] = __('(unknown)', 'edd'); } $value = $email . $this->row_actions($row_actions); return apply_filters('edd_payments_table_column', $value, $payment->ID, 'email'); }
/** * Payment History Page * * Renders the payment history page contents. * * @access private * @since 1.0 * @return void */ function edd_payment_history_page() { global $edd_options; if (isset($_GET['edd-action']) && $_GET['edd-action'] == 'edit-payment') { include_once EDD_PLUGIN_DIR . '/includes/admin-pages/forms/edit-payment.php'; } else { $current_page = admin_url('edit.php?post_type=download&page=edd-payment-history'); ?> <div class="wrap"> <?php if (isset($_GET['p'])) { $page = $_GET['p']; } else { $page = 1; } $per_page = 20; if (isset($_GET['show']) && $_GET['show'] > 0) { $per_page = intval($_GET['show']); } $total_pages = 1; $offset = $per_page * ($page - 1); $mode = isset($_GET['mode']) ? $_GET['mode'] : 'live'; if (edd_is_test_mode() && !isset($_GET['mode'])) { $mode = 'test'; } $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'ID'; $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; $order_inverse = $order == 'DESC' ? 'ASC' : 'DESC'; $order_class = strtolower($order_inverse); $user = isset($_GET['user']) ? $_GET['user'] : null; $status = isset($_GET['status']) ? $_GET['status'] : 'any'; $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; $payments = edd_get_payments(array('offset' => $offset, 'number' => $per_page, 'mode' => $mode, 'orderby' => $orderby, 'order' => $order, 'user' => $user, 'status' => $status, 'meta_key' => $meta_key)); $payment_count = wp_count_posts('edd_payment'); $total_count = $payment_count->publish + $payment_count->pending + $payment_count->refunded + $payment_count->trash; switch ($status) { case 'publish': $current_count = $payment_count->publish; break; case 'pending': $current_count = $payment_count->pending; break; case 'refunded': $current_count = $payment_count->refunded; break; case 'any': $current_count = $total_count; break; } $total_pages = ceil($current_count / $per_page); ?> <h2><?php _e('Payment History', 'edd'); ?> </h2> <?php do_action('edd_payments_page_top'); ?> <ul class="subsubsub"> <li class="all"> <a href="<?php echo remove_query_arg('status'); ?> " <?php echo !isset($_GET['status']) ? 'class="current"' : ''; ?> > <?php _e('All', 'edd'); ?> <span class="count">(<?php echo $total_count; ?> )</span> </a> | </li> <li class="publish"> <a href="<?php echo add_query_arg('status', 'publish'); ?> " <?php echo isset($_GET['status']) && $_GET['status'] == 'publish' ? 'class="current"' : ''; ?> ><?php _e('Completed', 'edd'); ?> <span class="count">(<?php echo $payment_count->publish; ?> )</span></a> | </li> <li class="pending"> <a href="<?php echo add_query_arg('status', 'pending'); ?> " <?php echo isset($_GET['status']) && $_GET['status'] == 'pending' ? 'class="current"' : ''; ?> ><?php _e('Pending', 'edd'); ?> <span class="count">(<?php echo $payment_count->pending; ?> )</span></a> | </li> <li class="refunded"> <a href="<?php echo add_query_arg('status', 'refunded'); ?> " <?php echo isset($_GET['status']) && $_GET['status'] == 'refunded' ? 'class="current"' : ''; ?> ><?php _e('Refunded', 'edd'); ?> <span class="count">(<?php echo $payment_count->refunded; ?> )</span></a> | </li> <?php do_action('edd_payments_page_statuses'); ?> </ul> <ul class="subsubsub edd-export-payments"> <li> <?php _e('Export', 'edd'); ?> : <a href="<?php echo add_query_arg('export', 'csv'); ?> ">CSV</a></li> <?php do_action('edd_payments_page_export_options'); ?> </ul> <form id="payments-filter" action="<?php echo admin_url('edit.php'); ?> " method="get" style="float: right; margin-bottom: 5px;"> <label for="edd-mode"><?php _e('Payment mode', 'edd'); ?> </label> <select name="mode" id="edd-mode"> <option value="live" <?php selected('live', $mode); ?> ><?php _e('Live', 'edd'); ?> </option> <option value="test" <?php selected('test', $mode); ?> ><?php _e('Test', 'edd'); ?> </option> </select> <input type="hidden" name="page" value="edd-payment-history"/> <input type="hidden" name="post_type" value="download"/> <?php if (isset($_GET['user'])) { ?> <input type="hidden" name="user" value="<?php echo $_GET['user']; ?> "/> <?php } ?> <?php if (isset($_GET['status'])) { ?> <input type="hidden" name="status" value="<?php echo $_GET['status']; ?> "/> <?php } ?> <label for="edd_show"><?php _e('Payments per page', 'edd'); ?> </label> <input type="text" class="regular-text" style="width:30px;" id="edd_show" name="show" value="<?php echo isset($_GET['show']) ? $_GET['show'] : ''; ?> "/> <input type="submit" class="button-secondary" value="<?php _e('Show', 'edd'); ?> "/> </form> <?php if (isset($_GET['user'])) { $user = is_numeric($user) ? get_userdata($user) : $user; $user = is_object($user) ? $user->display_name : $user; ?> <p class="clear"><?php echo __('Showing payments for: ', 'edd') . ' ' . $user; ?> - <a href="<?php echo remove_query_arg('user'); ?> "><?php _e('clear', 'edd'); ?> </a></div> <?php } ?> <table class="wp-list-table widefat fixed posts edd-payments"> <thead> <tr> <th style="width: 60px;" class="manage-column column-title sortable <?php echo $order_class; echo $orderby == 'ID' ? ' sorted' : ''; ?> "> <a href="<?php echo add_query_arg(array('orderby' => 'ID', 'order' => $order_inverse)); ?> " title="<?php _e('ID', 'edd'); ?> "><span><?php _e('ID', 'edd'); ?> </span> <span class="sorting-indicator"></span></a> </th> <th style="width: 250px;"><?php _e('Email', 'edd'); ?> </th> <th><?php _e('Products', 'edd'); ?> </th> <th> <a href="<?php echo add_query_arg(array('meta_key' => '_edd_payment_total', 'order' => $order_inverse, 'orderby' => 'meta_value_num')); ?> " title="<?php _e('Price', 'edd'); ?> "><span><?php _e('Price', 'edd'); ?> </span> <span class="sorting-indicator"></span></a> </th> <th class="manage-column column-title sortable <?php echo $order_class; echo $orderby == 'Date' ? ' sorted' : ''; ?> "> <a href="<?php echo add_query_arg(array('orderby' => 'post_date', 'order' => $order_inverse)); ?> " title="<?php _e('Date', 'edd'); ?> "><span><?php _e('Date', 'edd'); ?> </span> <span class="sorting-indicator"></span></a> </th> <th><?php _e('User', 'edd'); ?> </span></th> <th class="manage-column column-title sortable <?php echo $order_class; echo $orderby == 'Status' ? ' sorted' : ''; ?> "> <a href="<?php echo add_query_arg(array('orderby' => 'post_status', 'order' => $order_inverse)); ?> " title="<?php _e('Status', 'edd'); ?> "><span><?php _e('Status', 'edd'); ?> </span> <span class="sorting-indicator"></span></a> </th> </tr> </thead> <tfoot> <tr> <th style="width: 40px;"><?php _e('ID', 'edd'); ?> </th> <th style="width: 250px;"><?php _e('Email', 'edd'); ?> </th> <th><?php _e('Products', 'edd'); ?> </th> <th><?php _e('Price', 'edd'); ?> </th> <th><?php _e('Date', 'edd'); ?> </th> <th><?php _e('User', 'edd'); ?> </th> <th><?php _e('Status', 'edd'); ?> </th> </tr> </tfoot> <tbody> <?php if ($payments) { $i = 0; foreach ($payments as $payment) { ?> <?php $payment_meta = get_post_meta($payment->ID, '_edd_payment_meta', true); $user_info = maybe_unserialize($payment_meta['user_info']); $classes = array(); $classes[] = edd_is_odd($i) ? 'alternate' : ''; $payment_classes = get_post_class(apply_filters('edd_payment_row_classes', $classes), $payment->ID); ?> <tr class="edd_payment <?php echo implode(' ', $payment_classes); ?> "> <td> <?php echo $payment->ID; ?> </td> <td> <?php echo $payment_meta['email']; ?> <div class="row-actions"> <?php $row_actions = array('edit' => '<a href="' . add_query_arg(array('edd-action' => 'edit-payment', 'purchase_id' => $payment->ID)) . '">' . __('Edit', 'edd') . '</a>', 'email_links' => edd_is_payment_complete($payment->ID) ? '<a href="' . add_query_arg(array('edd-action' => 'email_links', 'purchase_id' => $payment->ID)) . '">' . __('Resend Purchase Receipt', 'edd') . '</a>' : NULL, 'delete' => '<a href="' . wp_nonce_url(add_query_arg(array('edd-action' => 'delete_payment', 'purchase_id' => $payment->ID)), 'edd_payment_nonce') . '">' . __('Delete', 'edd') . '</a>'); $row_actions = apply_filters('edd_payment_row_actions', $row_actions, $payment); $action_count = count($row_actions); $i = 1; foreach ($row_actions as $key => $action) { if ($action_count == $i) { $sep = ''; } else { $sep = ' | '; } echo !is_null($action) ? '<span class="' . $key . '">' . $action . '</span>' . $sep : ''; $i++; } ?> </div> </td> <td><a href="#TB_inline?width=640&inlineId=purchased-files-<?php echo $payment->ID; ?> " class="thickbox" title="<?php printf(__('Purchase Details for Payment #%s', 'edd'), $payment->ID); ?> "><?php _e('View Order Details', 'edd'); ?> </a> <div id="purchased-files-<?php echo $payment->ID; ?> " style="display:none;"> <?php $downloads = isset($payment_meta['cart_details']) ? maybe_unserialize($payment_meta['cart_details']) : false; if (empty($downloads) || !$downloads) { $downloads = maybe_unserialize($payment_meta['downloads']); } ?> <h4><?php echo _n(__('Purchased File', 'edd'), __('Purchased Files', 'edd'), count($downloads)); ?> </h4> <ul class="purchased-files-list"> <?php if ($downloads) { foreach ($downloads as $key => $download) { echo '<li>'; // retrieve the ID of the download $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; // if download has variable prices, override the default price $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; $user_info = unserialize($payment_meta['user_info']); // calculate the final price $price = edd_get_download_final_price($id, $user_info, $price_override); // show name of download echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '" target="_blank">' . get_the_title($id) . '</a>'; echo ' - '; if (isset($downloads[$key]['item_number'])) { $price_options = $downloads[$key]['item_number']['options']; if (isset($price_options['price_id'])) { echo edd_get_price_option_name($id, $price_options['price_id']); echo ' - '; } } // show price echo edd_currency_filter($price); echo '</li>'; } } ?> </ul> <p><?php echo __('Discount used:', 'edd') . ' '; if (isset($user_info['discount']) && $user_info['discount'] != 'none') { echo $user_info['discount']; } else { _e('none', 'edd'); } ?> <p><?php echo __('Total:', 'edd') . ' ' . edd_currency_filter($payment_meta['amount']); ?> </p> <div class="purcase-personal-details"> <h4><?php _e('Buyer\'s Personal Details:', 'edd'); ?> </h4> <ul> <li><?php echo __('Name:', 'edd') . ' ' . $user_info['first_name'] . ' ' . $user_info['last_name']; ?> </li> <li><?php echo __('Email:', 'edd') . ' ' . $payment_meta['email']; ?> </li> <?php do_action('edd_payment_personal_details_list', $payment_meta, $user_info); ?> </ul> </div> <?php $gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true); if ($gateway) { ?> <div class="payment-method"> <h4><?php _e('Payment Method:', 'edd'); ?> </h4> <span class="payment-method-name"><?php echo edd_get_gateway_admin_label($gateway); ?> </span> </div> <?php } ?> <div class="purchase-key-wrap"> <h4><?php _e('Purchase Key', 'edd'); ?> </h4> <span class="purchase-key"><?php echo $payment_meta['key']; ?> </span> </div> <p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php _e('Close', 'edd'); ?> "><?php _e('Close', 'edd'); ?> </a></p> </div> </td> <td style="text-transform:uppercase;"><?php echo edd_currency_filter($payment_meta['amount']); ?> </td> <td><?php echo date(apply_filters('edd_payments_page_date_format', get_option('date_format')), strtotime($payment->post_date)); ?> </td> <td> <?php $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email']; ?> <a href="<?php echo remove_query_arg('p', add_query_arg('user', $user_id)); ?> "> <?php if (is_numeric($user_id)) { $user = get_user_by('id', $user_id); echo is_object($user) ? $user->display_name : __('guest', 'edd'); } else { echo __('guest', 'edd'); } ?> </a> </td> <td><?php echo edd_get_payment_status($payment, true); ?> </td> </tr> <?php $i++; } } else { ?> <tr><td colspan="7"><?php _e('No payments recorded yet', 'edd'); ?> </td></tr> <?php } ?> </table> <div class="tablenav"> <div class="left edd-total-earnings"> <p><?php _e('Total Earnings:', 'edd'); ?> <strong><?php echo edd_get_total_earnings(); ?> </strong></p> <?php do_action('edd_payments_page_earnings'); ?> </div> <?php if ($total_pages > 1) { ?> <div class="tablenav-pages alignright"> <?php $query_string = $_SERVER['QUERY_STRING']; $base = 'edit.php?' . remove_query_arg('p', $query_string) . '%_%'; echo paginate_links(array('base' => $base, 'format' => '&p=%#%', 'prev_text' => '« ' . __('Previous', 'edd'), 'next_text' => __('Next', 'edd') . ' »', 'total' => $total_pages, 'current' => $page, 'end_size' => 1, 'mid_size' => 5)); ?> </div> <?php } ?> </div><!--end .tablenav--> <?php do_action('edd_payments_page_bottom'); ?> </div><!--end wrap--> <?php } }
/** * Render the email column * * @access private * @since 1.3.4 * @return string */ function column_email($item) { $payment = get_post($item['ID']); $base = admin_url('edit.php?post_type=download&page=edd-payment-history&edd-action=edit-payment&purchase_id=' . $item['ID']); $row_actions = array(); $row_actions['edit'] = '<a href="' . add_query_arg(array('edd-action' => 'edit-payment', 'purchase_id' => $payment->ID)) . '">' . __('Edit', 'edd') . '</a>'; if (edd_is_payment_complete($payment->ID)) { $row_actions['email_links'] = '<a href="' . add_query_arg(array('edd-action' => 'email_links', 'purchase_id' => $payment->ID)) . '">' . __('Resend Purchase Receipt', 'edd') . '</a>'; } $row_actions['delete'] = '<a href="' . wp_nonce_url(add_query_arg(array('edd-action' => 'delete_payment', 'purchase_id' => $payment->ID)), 'edd_payment_nonce') . '">' . __('Delete', 'edd') . '</a>'; $row_actions = apply_filters('edd_payment_row_actions', $row_actions, $payment); return $item['email'] . $this->row_actions($row_actions); }