Add option to users to delete their account from profile page

This commit is contained in:
DariusIII
2018-01-31 16:00:24 +01:00
parent 05f3b1314c
commit 6b40d3fc6c
7 changed files with 21 additions and 0 deletions
+1
View File
@@ -1,4 +1,5 @@
2018-01-31 DariusIII
* Chg: Add option to users to delete their account from profile page
* Fix: Fix count of regexes for pager in Regexes class
* Chg: Add option to fixtures up/down commands to specifiy which table fixtures to truncate or add
* Chg: Update some faulty regexes
+1
View File
@@ -51,6 +51,7 @@ switch ($page->page) {
case 'post_edit':
case 'profile':
case 'profileedit':
case 'profile_delete':
case 'queue':
case 'register':
case 'sabqueuedata':
+15
View File
@@ -0,0 +1,15 @@
<?php
use App\Models\User;
if (! User::isLoggedIn()) {
$page->show403();
}
$userId = $_GET['id'];
if ($userId !== null) {
User::logout();
User::deleteUser($userId);
header('Location: '.WWW_TOP.'/');
}
+1
View File
@@ -243,6 +243,7 @@
<a class="btn btn-primary" href="{$smarty.const.WWW_TOP}profileedit">Edit
Profile</a>
{/if}
<a class="btn btn-warning confirm_action" href="{$smarty.const.WWW_TOP}profile_delete?id={$user.id}">Delete your account</a>
</div>
</div>
</div>
+1
View File
@@ -4,6 +4,7 @@
{if !$publicview}
<li style="vertical-align:text-bottom;"><a href="{$smarty.const.WWW_TOP}/profileedit" class="btn btn-small btn-warning">Edit</a></li>
{/if}
<li style="vertical-align:text-bottom;"><a class="btn btn-warning confirm_action" href="{$smarty.const.WWW_TOP}profile_delete?id={$user.id}">Delete your account</a></li>
</ul>
<table class="data table" width="100%">
<tr>
+1
View File
@@ -251,6 +251,7 @@
<a class="btn btn-primary" href="{$smarty.const.WWW_TOP}profileedit">Edit
Profile</a>
{/if}
<a class="btn btn-warning confirm_action" href="{$smarty.const.WWW_TOP}profile_delete?id={$user.id}">Delete your account</a>
</div>
</div>
</div>
+1
View File
@@ -243,6 +243,7 @@
<a class="btn btn-primary" href="{$smarty.const.WWW_TOP}profileedit">Edit
Profile</a>
{/if}
<a class="btn btn-warning confirm_action" href="{$smarty.const.WWW_TOP}profile_delete?id={$user.id}">Delete your account</a>
</div>
</div>
</div>