LLMS_Notification_Controller_Purchase_Receipt::get_test_settings( string $type )

Get an array of LifterLMS Admin Page settings to send test notifications


Parameters Parameters

$type

(string) (Required) Notification type [basic|email].


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php

	public function get_test_settings( $type ) {

		$query = new WP_Query(
			array(
				'post_type'      => 'llms_transaction',
				'posts_per_page' => 25,
			)
		);

		$options = array(
			'' => '',
		);
		foreach ( $query->posts as $post ) {
			$transaction = llms_get_post( $post );
			$order       = $transaction->get_order();
			$student     = llms_get_student( $order->get( 'user_id' ) );
			if ( $transaction && $student ) {
				$options[ $transaction->get( 'id' ) ] = esc_attr(
					sprintf(
						// Translators: %1$d = The Order ID; %2$s The customer's full name; %3$s The product title.
						__( 'Order #%1$d from %2$s for "%3$s"', 'lifterlms' ),
						$order->get( 'id' ),
						$student->get_name(),
						$order->get( 'product_title' )
					)
				);
			}
		}

		return array(
			array(
				'class'             => 'llms-select2',
				'custom_attributes' => array(
					'data-allow-clear' => true,
					'data-placeholder' => __( 'Select a transaction', 'lifterlms' ),
				),
				'default'           => '',
				'id'                => 'transaction_id',
				'desc'              => '<br/>' . __( 'Send yourself a test notification using information from the selected transaction.', 'lifterlms' ),
				'options'           => $options,
				'title'             => __( 'Send a Test', 'lifterlms' ),
				'type'              => 'select',
				// 'selected' => false,
			),
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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