LLMS_Notification_Controller_Upcoming_Payment_Reminder::get_test_settings( string $type )

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


Description Description

Retrieves 25 recurring orders with an existing next payment date.


Top ↑

Parameters Parameters

$type

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


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php

406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
public function get_test_settings( $type ) {
 
    $query = new WP_Query(
        array(
            'post_type'      => 'llms_order',
            'posts_per_page' => 25,
            'post_status'    => array( 'llms-active', 'llms-failed', 'llms-on-hold', 'llms-pending', 'llms-pending-cancel' ),
            'meta_query'     => array(
                'relation' => 'and',
                array(
                    'key'     => '_llms_order_type',
                    'value'   => 'recurring',
                    'compare' => '=',
                ),
                array(
                    'key'     => '_llms_date_next_payment',
                    'compare' => 'EXISTS',
                ),
            ),
            'no_found_rows'  => true,
            'order_by'       => 'ID',
        )
    );
 
    $options = array(
        '' => '',
    );
    foreach ( $query->posts as $post ) {
        $order   = llms_get_post( $post );
        $student = llms_get_student( $order->get( 'user_id' ) );
        if ( $order && $student ) {
            $options[ $order->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 recurring order', 'lifterlms' ),
            ),
            'default'           => '',
            'id'                => 'order_id',
            'desc'              => '<br/>' . __( 'Send yourself a test notification using information from the selected recurring order.', 'lifterlms' ),
            'options'           => $options,
            'title'             => __( 'Send a Test', 'lifterlms' ),
            'type'              => 'select',
        ),
    );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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