From 32fa1e9e6beedf5f5b3eb5af4a399a3a895b2de6 Mon Sep 17 00:00:00 2001 From: "raja.lmsace@gmail.com" Date: Thu, 29 Feb 2024 10:26:36 +0530 Subject: [PATCH] Fixed the users delete issue on the tool skills plugin. --- classes/user.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/classes/user.php b/classes/user.php index 8eb4522..ba67ab9 100644 --- a/classes/user.php +++ b/classes/user.php @@ -148,16 +148,13 @@ public function get_user_skills() { public function remove_user_skillpoints() { global $DB; - // Fetch the list of user points record withdata skill data. - $skills = $this->get_user_points(false); - // List of skill ids. - $skillids = array_column($skills, 'id'); - // Delete user points. - $DB->delete_records('tool_skills_userpoints', ['id' => $skillids]); - // Delete the user points log. - $this->logs->delete_user_log($this->userid); + if ($DB->delete_records('tool_skills_userpoints', ['userid' => $this->userid])) { + $this->logs->delete_user_log($this->userid); + return true; + } + return false; } - + /** * Get user points list. *