LLMS_Student::get_enrollment_date( int $product_id, string $date = 'enrolled', string $format = null )

Get the formatted date when a user initially enrolled in a product or when they were last updated


Parameters Parameters

$product_id

(int) (Required) WP Post ID of a course or membership

$date

(string) (Optional) "enrolled" will get the most recent start date, "updated" will get the most recent status change date

Default value: 'enrolled'

$format

(string) (Optional) date format as accepted by php date(), if none supplied uses the WP core "date_format" option

Default value: null


Top ↑

Return Return

(false|string) will return false if the user is not enrolled


Top ↑

Source Source

File: includes/models/model.llms.student.php

487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
                $args['skip'],
                $args['limit'],
            )
        ),
        'OBJECT_K'
    ); // db call ok; no-cache ok.
    // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
 
    $found = absint( $wpdb->get_var( 'SELECT FOUND_ROWS()' ) ); // db call ok; no-cache ok.
 
    return array(
        'found'   => $found,
        'limit'   => $args['limit'],
        'more'    => ( $found > ( ( $args['skip'] / $args['limit'] + 1 ) * $args['limit'] ) ),
        'skip'    => $args['skip'],
        'results' => array_keys( $query ),
    );
 
}
 
/**
 * Get the formatted date when a user initially enrolled in a product or when they were last updated
 *
 * @since 3.0.0
 * @since 3.35.0 Prepare SQL properly.
 *
 * @param   int    $product_id  WP Post ID of a course or membership
 * @param   string $date        "enrolled" will get the most recent start date, "updated" will get the most recent status change date
 * @param   string $format      date format as accepted by php date(), if none supplied uses the WP core "date_format" option
 * @return  false|string        will return false if the user is not enrolled

Top ↑

Changelog Changelog

Changelog
Version Description
3.35.0 Prepare SQL properly.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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