From 2703d19aa070b80d398dfc30855e1f2e1cb00b00 Mon Sep 17 00:00:00 2001 From: kamilaindustrymedia <90174785+kamilaindustrymedia@users.noreply.github.com> Date: Mon, 8 May 2023 13:14:28 +0200 Subject: [PATCH] Fix `get_course_data` method if checking user different that currently logged one If we don't declare user ID in `LP_User_Item_Course` constructor, it will use result of `get_current_user_id()` (in /inc/user-item/class-lp-user-item.php, line 121), which returns wrong user item. --- inc/user/abstract-lp-user.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/user/abstract-lp-user.php b/inc/user/abstract-lp-user.php index 7ddce53e6..5f45845bb 100644 --- a/inc/user/abstract-lp-user.php +++ b/inc/user/abstract-lp-user.php @@ -126,7 +126,10 @@ public function get_course_data( int $course_id = 0 ) { * Todo: some themes still not check false, so still use below code.\ * @editor tungnx 4.1.6.9 */ - $object_course_data = new LP_User_Item_Course( $course_id ); + $object_course_data = new LP_User_Item_Course( array( + 'item_id' => $course_id, + 'user_id' => $this->get_id(), + ) ); } } catch ( Throwable $e ) { $object_course_data = false;