PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.8
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / inc / Databases / class-lp-user-db.php

class-lp-user-db.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.8, at inc/Databases/class-lp-user-db.php

55 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class LP_Course_DB
4 *
5 * @author tungnx
6 * @since 3.2.7.5
7 */
8
9 use LearnPress\Helpers\Singleton;
10
11 defined( 'ABSPATH' ) || exit();
12
13 class LP_User_DB extends LP_Database {
14 use singleton;
15
16 public function init() {
17 parent::__construct();
18 }
19
20 /**
21 * Get users
22 *
23 * @param LP_User_Filter $filter
24 * @param int $total_rows
25 *
26 * @since 4.2.6.9
27 * @version 1.0.0
28 * @return array|object|null|int|string
29 * @throws Exception
30 */
31 public function get_users( LP_User_Filter $filter, int &$total_rows = 0 ) {
32 $filter->fields = array_merge( $filter->all_fields, $filter->fields );
33
34 if ( empty( $filter->collection ) ) {
35 $filter->collection = $this->tb_users;
36 }
37
38 if ( empty( $filter->collection_alias ) ) {
39 $filter->collection_alias = 'u';
40 }
41
42 $ca = $filter->collection_alias;
43
44 // Find ID
45 if ( isset( $filter->ID ) ) {
46 $filter->where[] = $this->wpdb->prepare( "AND $ca.ID = %d", $filter->ID );
47 }
48
49 $filter = apply_filters( 'lp/user/query/filter', $filter );
50
51 return $this->execute( $filter, $total_rows );
52 }
53 }
54
55