LLMS_Admin_Post_Table_Orders::manage_columns( string $column, int $post_id )

Order post: Queries data based on column name.


Parameters Parameters

$column

(string) (Required) Custom column name.

$post_id

(int) (Required) ID of the individual post.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/post-types/post-tables/class.llms.admin.post.table.orders.php

	public function manage_columns( $column, $post_id ) {
		global $post;

		$order = new LLMS_Order( $post_id );

		switch ( $column ) {

			case 'order':
				echo '<a href="' . admin_url( 'post.php?post=' . $post_id . '&action=edit' ) . '">';
					printf( _x( '#%d', 'order number display', 'lifterlms' ), $post_id );
				echo '</a> ';

				_e( 'by', 'lifterlms' );
				echo ' ';

				if ( llms_parse_bool( $order->get( 'anonymized' ) ) || empty( llms_get_student( $order->get( 'user_id' ) ) ) ) {
					echo $order->get_customer_name();
				} else {
					$edit_user_link = $order->get( 'user_id' ) ? get_edit_user_link( $order->get( 'user_id' ) ) : '';
					echo ! $edit_user_link ? $order->get_customer_name() . '<br>' : '<a href="' . $edit_user_link . '">' . $order->get_customer_name() . '</a><br>';
					echo '<a href="mailto:' . $order->get( 'billing_email' ) . '">' . $order->get( 'billing_email' ) . '</a>';
				}

				break;

			case 'payment_status':
				$status = $order->get( 'status' );
				echo '<span class="llms-status llms-size--large ' . $status . ' ">' . llms_get_order_status_name( $status ) . '</span>';

				break;

			case 'access_status':
				$date = $order->get_access_expiration_date( 'F j, Y' );
				$ts   = strtotime( $date );

				// Timestamp will be false if date is not a date.
				if ( $ts ) {

					if ( $ts < current_time( 'timestamp' ) ) {
						_ex( 'Expired:', 'access plan expiration', 'lifterlms' );
					} else {
						_ex( 'Expires:', 'access plan expiration', 'lifterlms' );
					}

					echo ' ' . $date;

				} else {

					echo $date;

				}

				break;

			case 'product':
				if ( llms_get_post( $order->get( 'product_id' ) ) ) {
					echo '<a href="' . get_edit_post_link( $order->get( 'product_id' ) ) . '">' . $order->get( 'product_title' ) . '</a>';
				} else {
					echo __( '[DELETED]', 'lifterlms' ) . ' ' . $order->get( 'product_title' );
				}
				echo ' (' . ucfirst( $order->get( 'product_type' ) ) . ')';

				break;

			case 'revenue':
				$grosse = $order->get_revenue( 'grosse' );
				$net    = $order->get_revenue( 'net' );

				if ( $grosse !== $net ) {
					echo '<del>' . llms_price( $grosse ) . '</del> ';
				}

				echo llms_price( $net );

				break;

			case 'type':
				if ( $order->is_recurring() ) {
					_e( 'Recurring', 'lifterlms' );
				} else {
					_e( 'One-time', 'lifterlms' );
				}

				break;

			case 'order_date':
				echo $order->get_date( 'date' );

				break;

		}// End switch().
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Treat the case when the order has no WordPress user associated yet.
5.4.0 Inform about deleted products.
3.19.0 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.