← All changes
|
inc/rest-api/v1/admin/class-lp-admin-rest-tools-controller.php
+4
-4
4.3.7
→
4.4.8
View file →
| @@ -567,9 +567,9 @@ | ||
| 567 | 567 | foreach ( $data as $user_course ) { |
| 568 | 568 | $user_id = $user_course['user_id'] ?? 0; |
| 569 | 569 | $course_id = $user_course['course_id'] ?? 0; |
| 570 | 570 | if ( ! $user_id || ! $course_id ) { |
| 571 | - throw new Exception( 'User or Course is invalid', 'learnpress' ); | |
| 571 | + throw new Exception( __( 'User or Course is invalid', 'learnpress' ) ); | |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | $can_handle = apply_filters( |
| 575 | 575 | 'learn-press/assign-courses-to-users/can-handle', |
| @@ -646,9 +646,9 @@ | ||
| 646 | 646 | foreach ( $data as $user_course ) { |
| 647 | 647 | $user_id = $user_course['user_id'] ?? 0; |
| 648 | 648 | $course_id = $user_course['course_id'] ?? 0; |
| 649 | 649 | if ( ! $user_id || ! $course_id ) { |
| 650 | - throw new Exception( 'User or Course is invalid', 'learnpress' ); | |
| 650 | + throw new Exception( __( 'User or Course is invalid', 'learnpress' ) ); | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | // Delete data user who already enrolled this course. |
| 654 | 654 | LP_User_Items_DB::getInstance()->delete_user_items_old( $user_id, $course_id ); |
| @@ -676,11 +676,11 @@ | ||
| 676 | 676 | * Check permission for request. |
| 677 | 677 | * |
| 678 | 678 | * @return bool |
| 679 | 679 | */ |
| 680 | - public function check_permission(): bool { | |
| 680 | + public function check_permission( $request = null ): bool { | |
| 681 | 681 | $permission = current_user_can( ADMIN_ROLE ); |
| 682 | - $permission = apply_filters( 'learn-press/api-admin-tools/permission', $permission ); | |
| 682 | + $permission = apply_filters( 'learn-press/api-admin-tools/permission', $permission, $request ); | |
| 683 | 683 | |
| 684 | 684 | return $permission; |
| 685 | 685 | } |
| 686 | 686 | } |