/** * Render column data * */ function render_learn_press_order_columns($column) { global $post; $the_order = learn_press_get_order($post->ID); $order_items = learn_press_get_order_items($post->ID); //$status = get_post_meta($post->ID, '_learn_press_transaction_status', true); switch ($column) { case 'order_student': //$user = new LPR_User( $post->uID ); ?> <a href="user-edit.php?user_id=<?php echo $post->user_ID; ?> "><?php echo $post->user_display_name; ?> </a><?php break; case 'order_status': echo learn_press_get_order_status_label($post->ID); break; case 'order_date': $t_time = get_the_time('Y/m/d g:i:s a'); $m_time = $post->post_date; $time = get_post_time('G', true, $post); $time_diff = current_time('timestamp') - $time; if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) { $h_time = sprintf(__('%s ago', 'learn_press'), human_time_diff($time)); } else { $h_time = mysql2date('Y/m/d', $m_time); } echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('learn_press_order_column_time', $h_time, $the_order)) . '</abbr>'; break; case 'order_items': if ($products = learn_press_get_transition_products($post->ID)) { $links = array(); foreach ($products as $pro) { $links[] = '<a href="' . get_the_permalink($pro->ID) . '">' . get_the_title($pro->ID) . '</a>'; } echo join("<br />", $links); } else { _e("Course has been removed", 'learn_press'); } break; case 'order_total': echo learn_press_format_price(empty($order_items->total) ? 0 : $order_items->total, learn_press_get_currency_symbol($order_items->currency)); break; case 'order_title': $order_number = sprintf("%'.010d", $the_order->ID); ?> <div class="tips"> <a href="post.php?post=<?php echo $the_order->ID; ?> &action=edit"><strong><?php echo learn_press_transaction_order_number($order_number); ?> </strong></a> </div> <?php break; } }
/** * Render column data * */ function columns_content($column) { global $post; $the_order = learn_press_get_order($post->ID); //print_r($the_order->get_items());die(); switch ($column) { case 'order_student': if ($the_order->user_id) { $user = learn_press_get_user($the_order->user_id); printf('<a href="user-edit.php?user_id=%d">%s (%s)</a>', $the_order->user_id, $user->user_login, $user->display_name); printf('<br /><span>%s</span>', $user->user_email); } else { _e('Guest', 'learn_press'); } break; case 'order_status': echo learn_press_get_order_status_label($post->ID); break; case 'order_date': $t_time = get_the_time('Y/m/d g:i:s a'); $m_time = $post->post_date; $time = get_post_time('G', true, $post); $time_diff = current_time('timestamp') - $time; if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) { $h_time = sprintf(__('%s ago', 'learn_press'), human_time_diff($time)); } else { $h_time = mysql2date('Y/m/d', $m_time); } echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('learn_press_order_column_time', $h_time, $the_order)) . '</abbr>'; break; case 'order_items': $links = array(); foreach ($the_order->get_items() as $item) { $links[] = '<a href="' . get_the_permalink($item['course_id']) . '">' . get_the_title($item['course_id']) . '</a>'; } echo join("<br />", $links); break; case 'order_total': echo learn_press_format_price($the_order->order_total, learn_press_get_currency_symbol($the_order->order_currency)); break; case 'order_title': $order_number = sprintf("%'.010d", $the_order->ID); ?> <div class="tips"> <a href="post.php?post=<?php echo $the_order->ID; ?> &action=edit"><strong><?php echo learn_press_transaction_order_number($order_number); ?> </strong></a> </div> <?php break; } }