Skip to content

Commit

Permalink
Fixed the users delete issue on the tool skills plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
raja-lmsace committed Feb 29, 2024
1 parent c142d58 commit 32fa1e9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions classes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 32fa1e9

Please sign in to comment.