# subscription/1.9.6/includes/Admin/views/subscription-list.php

Subscriptions for WooCommerce with Stripe Recurring Payments, version 1.9.6. 277 lines.

- Page: https://pluginprobe.com/plugins/subscription/1.9.6/code/includes/Admin/views/subscription-list.php
- Raw: https://pluginprobe.com/plugins/subscription/1.9.6/raw/includes/Admin/views/subscription-list.php
- Modified: 2026-03-30T08:58:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/subscription/1.9.6/code/includes/Admin/views/subscription-list.php#L10-L20`.

```php
<?php
/**
 * Subscription admin list view.
 *
 * @package SpringDevs\Subscription\Admin
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! isset( $date_filter ) ) {
	$date_filter = '';
}

// Determine if filters are active
$filters_active = ! empty( $status ) || ! empty( $date_filter ) || ! empty( $search );
$months         = array();
for ( $i = 0; $i < 12; $i++ ) {
	$month                           = strtotime( "-$i month" );
	$months[ date( 'Y-m', $month ) ] = date( 'F Y', $month );
}
?>
<div class="wp-subscription-admin-content list-page">
	<div class="wp-subscription-list-title"><h1 class="wp-heading-inline">Subscriptions</h1></div>
	
	<form method="post" id="subscriptions-form">
		<div class="wp-subscription-list-header">
			<div class="wp-subscription-filters">
				<?php wp_nonce_field( 'subscrpt_list_action' ); ?>
				<input type="hidden" name="page" value="wp-subscription" />
				<select name="subscrpt_status" value="<?php echo esc_attr( $status ); ?>">
					<option value=""><?php esc_html_e( 'All Status', 'subscription' ); ?></option>
					<option value="active" <?php selected( $status, 'active' ); ?>><?php esc_html_e( 'Active', 'subscription' ); ?></option>
					<option value="pending" <?php selected( $status, 'pending' ); ?>><?php esc_html_e( 'Pending', 'subscription' ); ?></option>
					<option value="cancelled" <?php selected( $status, 'cancelled' ); ?>><?php esc_html_e( 'Cancelled', 'subscription' ); ?></option>
					<option value="expired" <?php selected( $status, 'expired' ); ?>><?php esc_html_e( 'Expired', 'subscription' ); ?></option>
					<option value="draft" <?php selected( $status, 'draft' ); ?>><?php esc_html_e( 'Draft', 'subscription' ); ?></option>
					<option value="trash" <?php selected( $status, 'trash' ); ?>><?php esc_html_e( 'Trash', 'subscription' ); ?></option>
				</select>
				<select name="date_filter" value="<?php echo esc_attr( $date_filter ); ?>">
					<option value=""><?php esc_html_e( 'All Dates', 'subscription' ); ?></option>
					<?php foreach ( $months as $val => $label ) : ?>
						<option value="<?php echo esc_attr( $val ); ?>" <?php selected( $date_filter, $val ); ?>><?php echo esc_html( $label ); ?></option>
					<?php endforeach; ?>
				</select>
				<input type="search" name="s" value="<?php echo esc_attr( $search ); ?>" placeholder="<?php esc_attr_e( 'Search by subscription ID...', 'subscription' ); ?>" />
				<select name="per_page">
					<?php foreach ( array( 10, 20, 50, 100 ) as $n ) : ?>
						<option value="<?php echo (int) $n; ?>" <?php selected( isset( $_GET['per_page'] ) ? intval( wp_unslash( $_GET['per_page'] ) ) : 20, $n ); ?>><?php echo (int) $n; ?> per page</option>
					<?php endforeach; ?>
				</select>
				<button type="submit" name="filter_action" value="filter" class="button">Search</button>
				<?php if ( $filters_active ) : ?>
					<a href="<?php echo esc_url( remove_query_arg( array( 'subscrpt_status', 'date_filter', 's', 'title', 'paged' ) ) ); ?>" class="button">Reset</a>
				<?php endif; ?>
				<?php if ( $filters_active ) : ?>
					<span>Filters applied</span>
				<?php endif; ?>
			</div>
			
			<?php if ( ! empty( $subscriptions ) ) : ?>
			<div class="wp-subscription-bulk-actions">
				<select name="action">
					<option value="-1"><?php esc_html_e( 'Bulk Actions', 'subscription' ); ?></option>
					<?php if ( $status === 'trash' ) : ?>
						<option value="restore"><?php esc_html_e( 'Restore', 'subscription' ); ?></option>
						<option value="delete"><?php esc_html_e( 'Delete Permanently', 'subscription' ); ?></option>
					<?php else : ?>
						<option value="trash"><?php esc_html_e( 'Move to Trash', 'subscription' ); ?></option>
					<?php endif; ?>
				</select>
				<input type="submit" name="bulk_action" value="<?php esc_attr_e( 'Apply', 'subscription' ); ?>" class="button action">
				<?php if ( $status === 'trash' && ! empty( $subscriptions ) ) : ?>
					<?php
					$nonce_action    = 'wpsubs_action_clean_trash';
					$empty_trash_url = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=clean_trash&sub_id=all' ), $nonce_action );
					?>
					<a href="<?php echo esc_url( $empty_trash_url ); ?>" 
						class="button button-link-delete" 
						onclick="return confirm('<?php esc_attr_e( 'Are you sure you want to permanently delete all items in trash? This action cannot be undone.', 'subscription' ); ?>')">
						<?php esc_html_e( 'Empty Trash', 'subscription' ); ?>
					</a>
				<?php endif; ?>
			</div>
			<?php endif; ?>
		</div>
	
		<h2 class="screen-reader-text">Subscriptions list</h2>
		<table class="wp-list-table widefat fixed striped wp-subscription-modern-table">
			<thead>
				<tr>
					<th style="width:20px;"><input type="checkbox" id="cb-select-all-1"></th>
					<th style="width:180px;">ID</th>
					<th style="min-width:320px;">Title</th>
					<th style="width:180px;">Customer</th>
					<th style="width:100px;">Start Date</th>
					<th style="width:100px;">Renewal Date</th>
					<th style="width:100px;">Status</th>
					<th style="width:80px;">Actions</th>
				</tr>
			</thead>
			<tbody>
			<?php if ( ! empty( $subscriptions ) ) : ?>
				<?php
				foreach ( $subscriptions as $subscription ) :
					$subscription_id   = $subscription->ID;
					$subscription_data = SpringDevs\Subscription\Illuminate\Helper::get_subscription_data( $subscription_id );

					$subscrpt_status = $subscription_data['status'] ?? '';
					$subscrpt_status = empty( $subscrpt_status ) ? get_post_status( $subscription_id ) : $subscrpt_status;

					$order_id      = $subscription_data['order']['order_id'] ?? 0;
					$order_item_id = $subscription_data['order']['order_item_id'] ?? 0;
					$order         = $order_id ? wc_get_order( $order_id ) : null;
					$order_item    = $order ? $order->get_item( $order_item_id ) : null;
					$product_name  = $order_item ? $order_item->get_name() : '-';

					$customer       = $order ? $order->get_formatted_billing_full_name() : '-';
					$customer_id    = $order ? $order->get_customer_id() : 0;
					$customer_url   = $customer_id ? admin_url( 'user-edit.php?user_id=' . $customer_id ) : '';
					$customer_email = $order ? $order->get_billing_email() : '';

					$start_date   = $subscription_data['start_date'] ? strtotime( $subscription_data['start_date'] ) : 0;
					$renewal_date = $subscription_data['next_date'] ? strtotime( $subscription_data['next_date'] ) : 0;
					$status_obj   = get_post_status_object( get_post_status( $subscription->ID ) );

					$is_trash = $subscription->post_status === 'trash';

					$is_grace_period = isset( $subscription_data['grace_period'] );
					$grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;

					// Build URLs
					$nonce_action       = 'wpsubs_action_' . $subscription->ID;
					$view_subs_url      = get_edit_post_link( $subscription->ID );
					$duplicate_subs_url = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=duplicate&sub_id=' . $subscription->ID ), $nonce_action );
					$trash_subs_url     = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=trash&sub_id=' . $subscription->ID ), $nonce_action );
					$del_per_subs_url   = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=delete&sub_id=' . $subscription->ID ), $nonce_action );
					$restore_subs_url   = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=restore&sub_id=' . $subscription->ID ), $nonce_action );
					?>
				<tr>
					<td><input type="checkbox" name="subscription_ids[]" value="<?php echo esc_attr( $subscription->ID ); ?>"></td>
					<td>
						<div class="wp-subscription-title-wrap">
							<a href="<?php echo esc_url( $view_subs_url ); ?>" class="subscrpt-id-link">
								#<?php echo esc_html( get_the_title( $subscription->ID ) ); ?>
							</a>

							<div class="wp-subscription-row-actions">
								<?php if ( ! $is_trash ) : ?>
									<a href="<?php echo esc_url( $view_subs_url ); ?>">View</a>

									<!-- <a href="<?php echo esc_url( $duplicate_subs_url ); ?>">Duplicate</a> -->

									<a href="<?php echo esc_url( $trash_subs_url ); ?>" onclick="return confirm('<?php esc_attr_e( 'Move this subscription to trash?', 'subscription' ); ?>')">Trash</a>

								<?php else : ?>
									<a href="<?php echo esc_url( $restore_subs_url ); ?>">Restore</a>

									<a href="<?php echo esc_url( $del_per_subs_url ); ?>" onclick="return confirm('<?php esc_attr_e( 'Delete this subscription permanently? This action cannot be undone.', 'subscription' ); ?>')" style="color:#d93025;">Delete Permanently</a>
								<?php endif; ?>
							</div>
						</div>
					</td>
					<td style="min-width:320px;">
						<span><?php echo esc_html( $product_name ); ?></span>
					</td>
					<td>
						<?php if ( $customer_url ) : ?>
							<a href="<?php echo esc_url( $customer_url ); ?>" target="_blank"><?php echo esc_html( $customer ); ?></a>
						<?php else : ?>
							<?php echo esc_html( $customer ); ?>
						<?php endif; ?>
						<?php if ( $customer_email ) : ?>
							<div class="wp-subscription-customer-email"><?php echo esc_html( $customer_email ); ?></div>
						<?php endif; ?>
					</td>
					<td><?php echo $start_date ? esc_html( wp_date( 'F d, Y', $start_date ) ) : '-'; ?></td>
					<td><?php echo $renewal_date ? esc_html( wp_date( 'F d, Y', $renewal_date ) ) : '-'; ?></td>
					<td>
						<?php if ( $is_grace_period && $grace_remaining > 0 ) : ?>
							<span class="subscrpt-active grace-active">
								Active

								<?php
									$grace_remaining_text = sprintf(
										// translators: Number of days remaining in grace period.
										__( '%d days remaining!', 'subscription' ),
										$grace_remaining
									);
								?>
								<span class="grace-icon" data-tooltip="<?php echo esc_attr( $grace_remaining_text ); ?>">
									<span class="dashicons dashicons-warning"></span>
								</span>
							</span>
						<?php else : ?>
							<span class="subscrpt-<?php echo esc_attr( strtolower( $subscrpt_status ) ); ?>">
								<?php
									$verbose_status = SpringDevs\Subscription\Illuminate\Helper::get_verbose_status( $subscrpt_status );
									echo esc_html( strlen( $verbose_status ) > 9 ? substr( $verbose_status, 0, 9 ) . '...' : $verbose_status );
								?>
							</span>
						<?php endif; ?>
					</td>
					<td>
						<a href="<?php echo esc_url( get_edit_post_link( $subscription->ID ) ); ?>" class="button button-small"><?php esc_html_e( 'Edit', 'subscription' ); ?></a>
					</td>
				</tr>
				<?php endforeach; ?>
			<?php else : ?>
				<tr>
					<td colspan="8" class="wp-subscription-list-empty">
						<?php esc_html_e( 'No subscriptions found.', 'subscription' ); ?>
					</td>
				</tr>
			<?php endif; ?>
			</tbody>
		</table>
		
		<?php if ( ! empty( $subscriptions ) ) : ?>
			<div class="tablenav bottom">
				<div class="alignleft actions bulkactions">
					<select name="action2">
						<option value="-1"><?php esc_html_e( 'Bulk Actions', 'subscription' ); ?></option>
						<?php if ( $status === 'trash' ) : ?>
							<option value="restore"><?php esc_html_e( 'Restore', 'subscription' ); ?></option>
							<option value="delete"><?php esc_html_e( 'Delete Permanently', 'subscription' ); ?></option>
						<?php else : ?>
							<option value="trash"><?php esc_html_e( 'Move to Trash', 'subscription' ); ?></option>
						<?php endif; ?>
					</select>
					<input type="submit" name="bulk_action2" value="<?php esc_attr_e( 'Apply', 'subscription' ); ?>" class="button action">
				</div>
			</div>
		<?php endif; ?>
	</form>
	
	<?php if ( $max_num_pages > 1 ) : ?>
	<div class="wp-subscription-pagination">
		<span class="total">Total <?php echo (int) $total; ?></span>
		<?php
		$base_url   = remove_query_arg( 'paged' );
		$show_pages = $max_num_pages > 1 || $max_num_pages == 1;
		for ( $i = 1; $i <= $max_num_pages; $i++ ) :
			$url        = add_query_arg(
				array(
					'paged'    => $i,
					'per_page' => $per_page,
				),
				$base_url
			);
			$is_current = $i == $paged;
			?>
			<a href="<?php echo esc_url( $url ); ?>" class="button
			<?php
			if ( $is_current ) {
				echo ' button-primary';}
			?>
			" 
			<?php
			if ( $is_current ) {
				echo 'disabled';}
			?>
><?php echo (int) $i; ?></a>
		<?php endfor; ?>
		<span class="goto-label">Go to</span>
		<form method="get">
			<input type="hidden" name="page" value="wp-subscription" />
			<input type="number" name="paged" min="1" max="<?php echo (int) $max_num_pages; ?>" value="<?php echo (int) $paged; ?>" />
			<input type="hidden" name="per_page" value="<?php echo (int) $per_page; ?>" />
			<button type="submit" class="button">OK</button>
		</form>
	</div>
	<?php endif; ?>
</div>

```
