PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.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 All 140 releases
← All changes | inc/rest-api/v1/frontend/class-lp-rest-student-controller.php +58 -58 4.3.9 → 4.4.9 View file →
@@ -1,58 +1,58 @@
1 -<?php
2 -/**
3 - * REST API LP Student.
4 - *
5 - * @class LP_REST_Student_Controller
6 - * @author thimpress
7 - * @version 1.0.0
8 - */
9 -
10 -class LP_REST_Student_Controller extends LP_Abstract_REST_Controller {
11 - public function __construct() {
12 - $this->namespace = 'lp/v1';
13 - $this->rest_base = 'students';
14 -
15 - parent::__construct();
16 - }
17 -
18 - public function register_routes() {
19 - $this->routes = array(
20 - array(
21 - 'methods' => WP_REST_Server::CREATABLE,
22 - 'callback' => array( $this, 'list_students' ),
23 - 'permission_callback' => '__return_true',
24 - ),
25 - );
26 -
27 - parent::register_routes();
28 - }
29 -
30 - /**
31 - * Get list student attend
32 - *
33 - * @param WP_REST_Request $request
34 - *
35 - * @return LP_REST_Response
36 - */
37 - public function list_students( WP_REST_Request $request ): LP_REST_Response {
38 - $response = new LP_REST_Response();
39 -
40 - try {
41 - $params = $request->get_params();
42 - $course_id = absint( $params['courseId'] ?? 0 );
43 - $status = $params['status'] ?? '';
44 - $paged = absint( $params['paged'] ?? 1 );
45 - $limit = LP_Settings::get_option( 'archive_course_limit', 10 );
46 -
47 - $filter = new LP_User_Items_Filter();
48 - $students = LP_User_Items_DB::getInstance()->get_students( $filter );
49 -
50 - $response->status = 'success';
51 - $response->data->content = $students;
52 - } catch ( Throwable $e ) {
53 - $response->message = $e->getMessage();
54 - }
55 -
56 - return $response;
57 - }
58 -}
1 +<?php
2 +/**
3 + * REST API LP Student.
4 + *
5 + * @class LP_REST_Student_Controller
6 + * @author thimpress
7 + * @version 1.0.0
8 + */
9 +
10 +class LP_REST_Student_Controller extends LP_Abstract_REST_Controller {
11 + public function __construct() {
12 + $this->namespace = 'lp/v1';
13 + $this->rest_base = 'students';
14 +
15 + parent::__construct();
16 + }
17 +
18 + public function register_routes() {
19 + $this->routes = array(
20 + array(
21 + 'methods' => WP_REST_Server::CREATABLE,
22 + 'callback' => array( $this, 'list_students' ),
23 + 'permission_callback' => '__return_true',
24 + ),
25 + );
26 +
27 + parent::register_routes();
28 + }
29 +
30 + /**
31 + * Get list student attend
32 + *
33 + * @param WP_REST_Request $request
34 + *
35 + * @return LP_REST_Response
36 + */
37 + public function list_students( WP_REST_Request $request ): LP_REST_Response {
38 + $response = new LP_REST_Response();
39 +
40 + try {
41 + $params = $request->get_params();
42 + $course_id = absint( $params['courseId'] ?? 0 );
43 + $status = $params['status'] ?? '';
44 + $paged = absint( $params['paged'] ?? 1 );
45 + $limit = LP_Settings::get_option( 'archive_course_limit', 10 );
46 +
47 + $filter = new LP_User_Items_Filter();
48 + $students = LP_User_Items_DB::getInstance()->get_students( $filter );
49 +
50 + $response->status = 'success';
51 + $response->data->content = $students;
52 + } catch ( Throwable $e ) {
53 + $response->message = $e->getMessage();
54 + }
55 +
56 + return $response;
57 + }
58 +}