Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix resetting progress from achievement page #1117

Merged
merged 1 commit into from Sep 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 19 additions & 5 deletions public/achievementInfo.php
Expand Up @@ -146,6 +146,24 @@ function updateAchievementTypeFlag(typeFlag) {
}
</script>
<?php endif ?>

<?php if ($achievedLocal): ?>
luchaos marked this conversation as resolved.
Show resolved Hide resolved
<script>
function ResetProgress() {
if (confirm('Are you sure you want to reset this progress?')) {
showStatusMessage('Updating...');

$.post('/request/user/reset-achievements.php', {
achievement: <?= $achievementID ?>
})
.done(function () {
location.reload();
});
}
}
</script>
<?php endif ?>

<div id="mainpage">
<div id="leftcontainer">
<?php
Expand Down Expand Up @@ -231,11 +249,7 @@ function updateAchievementTypeFlag(typeFlag) {
echo "<div class='devbox mb-3'>";
echo "<span onclick=\"$('#resetboxcontent').toggle(); return false;\">Reset Progress ▼</span>";
echo "<div id='resetboxcontent' style='display: none'>";
echo "<form action='/request/user/reset-achievements.php' method='post' onsubmit='return confirm(\"Are you sure you want to reset this progress?\")'>";
echo csrf_field();
echo "<input type='hidden' name='a' value='$achievementID'>";
luchaos marked this conversation as resolved.
Show resolved Hide resolved
echo "<input type='submit' value='Reset this achievement'>";
echo "</form>";
echo "<button class='btn btn-danger' type='button' onclick='ResetProgress()'>Reset this achievement</button>";
echo "</div></div>";
}
echo "<br>";
Expand Down