Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Blocks_Visibility::get_enrollment_count_by_type( int $uid, string $type )
Get the number of enrollments for a user by post type.
Description Description
Parameters Parameters
- $uid
-
(int) (Required) WP_User ID.
- $type
-
(string) (Required) post type.
Return Return
(int)
Source Source
File: vendor/lifterlms/lifterlms-blocks/includes/class-llms-blocks-visibility.php
private function get_enrollment_count_by_type( $uid, $type ) { $found = 0; $student = llms_get_student( $uid ); $type = str_replace( 'any_', '', $type ); if ( 'course' === $type || 'membership' === $type ) { $enrollments = $student->get_enrollments( $type, array( 'limit' => 1 ) ); $found = $enrollments['found']; } elseif ( 'any' === $type ) { $found = $this->get_enrollment_count_by_type( $uid, 'course' ); if ( ! $found ) { $found = $this->get_enrollment_count_by_type( $uid, 'membership' ); } } return $found; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: