Hello, i found out how the user can delete the own account. This Mod was on the old board. The User i don´t no...
make a backup before edit the files:
files to edit:./member.php
./template/<your language>/user_logininfo.html OR .templates/<your language>/member_editprofile.htmlfiles to dreate:
./template/<your language>/member_deleteaccount.htmlopen member.php
find:
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
add before:
//-----------------------------------------------------
//--- Delete Account ----------------------------------
//-----------------------------------------------------
if ($action == "deleteaccount"){
$passwort=$HTTP_POST_VARS[passwort];
$progress=$HTTP_POST_VARS[progress];
$user_id=$user_info['user_id'];
$user_name=$user_info['user_name'];
if ($progress == 1){
if(md5($passwort) == $user_info['user_password']){
// Group Sachen
$sql = "DELETE FROM ".GROUP_MATCH_TABLE."
WHERE user_id = $user_id";
$site_db->query($sql);
$sql = "SELECT group_id
FROM ".GROUPS_TABLE."
WHERE group_name = '$user_name' AND group_type = ".GROUPTYPE_SINGLE;
if ($groups_row = $site_db->query_firstrow($sql)) {
$sql = "DELETE FROM ".GROUPS_TABLE."
WHERE group_id = ".$groups_row['group_id']." AND group_type = ".GROUPTYPE_SINGLE;
$site_db->query($sql);
$sql = "DELETE FROM ".GROUP_ACCESS_TABLE."
WHERE group_id = ".$groups_row['group_id'];
$site_db->query($sql);
}
//Lighbox
$sql = "DELETE FROM ".LIGHTBOXES_TABLE."
WHERE user_id = $user_id";
$site_db->query($sql);
//Update Images
$sql = "UPDATE ".IMAGES_TABLE."
SET user_id = ".GUEST."
WHERE user_id = $user_id";
$site_db->query($sql);
//Update Comments
$sql = "UPDATE ".COMMENTS_TABLE."
SET user_id = ".GUEST.", user_name = '$user_name'
WHERE user_id = $user_id";
$site_db->query($sql);
//Delete User
$sql = "DELETE FROM ".USERS_TABLE."
WHERE user_id = ".$user_id."";
if($site_db->query($sql)) {
$msg = "<b>".$user_name." your account with the ID: ".$user_id." successfully one deleted.</b>";
$site_sess->logout($user_info['user_id']);
header("Location: ".$site_sess->url(ROOT_PATH."index.php?msg=".$msg.""));
}else{
$msg = "<b>Your account could not be deleted please turn you to a Admin, thereby the account to be manually deleted can!!!</b>";
}
}else{
$msg= "The account could not be deleted, since the password is wrong. Please it tries again.";
}
$content = $site_template->parse_template("member_deleteaccount");
}else{
$content = $site_template->parse_template("member_deleteaccount");
}
}
then create a new .html named: member_deleteaccount.html
<form method="post" action="{url_member}" enctype="multipart/form-data" onsubmit="submit.disabled=true;">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">delete Account</td>
</tr>
<tr>
<td class="row2">It harms that you want to leave us!!!<p>Please your password enters for safety reasons:<input type="password" name="passwort" class="input" size="20"></td>
</tr>
</table>
</td>
</tr>
</table><center>
<input type="hidden" name="action" value="deleteaccount">
<input type="hidden" name="progress" value="1">
<input type="submit" name="submit" value="delete Account :-(" class="button">
<input type="reset" name="reset" value="ohh not :-)" class="button"onClick="window.open('{url_home}', '_top');">
</form>
if you want show the link DELETE ACCOUNT in the user_logininfo.html
then open the user_logininfo.html and find:
» <a href="{url_control_panel}">{lang_control_panel}</a><br />
add after:
» <a href="./member.php?action=deleteaccount">Delete Account</a><br />
if you want show the link DELETE ACCOUNT in the member_editprofile.html
then open the member_editprofile.html and find:
<form method="post" action="{url_member}" enctype="multipart/form-data">
add
above this:
<center><a href="./member.php?action=deleteaccount">Delete Account</a></center><br />
thats all. Uplod the files. for testing create a new user and delete him on his controlpanel. DONT use your User. it deletes all!!!!
--------------------
----Deutsch-------
--------------------
so kann der User seinen Account löschen.
Macht vorher einen Backup bevor ihr die Dateien ändert!!!
zubearbeitene Dateien:
./member.php
./template/<your language>/user_logininfo.html ODER .templates/<your language>/member_editprofile.htmlzu erstellende Dateien:
./template/<your language>/member_deleteaccount.htmlöffne member.php
finde:
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
füge davor ein:
//-----------------------------------------------------
//--- Delete Account ----------------------------------
//-----------------------------------------------------
if ($action == "deleteaccount"){
$passwort=$HTTP_POST_VARS[passwort];
$progress=$HTTP_POST_VARS[progress];
$user_id=$user_info['user_id'];
$user_name=$user_info['user_name'];
if ($progress == 1){
if(md5($passwort) == $user_info['user_password']){
// Group Sachen
$sql = "DELETE FROM ".GROUP_MATCH_TABLE."
WHERE user_id = $user_id";
$site_db->query($sql);
$sql = "SELECT group_id
FROM ".GROUPS_TABLE."
WHERE group_name = '$user_name' AND group_type = ".GROUPTYPE_SINGLE;
if ($groups_row = $site_db->query_firstrow($sql)) {
$sql = "DELETE FROM ".GROUPS_TABLE."
WHERE group_id = ".$groups_row['group_id']." AND group_type = ".GROUPTYPE_SINGLE;
$site_db->query($sql);
$sql = "DELETE FROM ".GROUP_ACCESS_TABLE."
WHERE group_id = ".$groups_row['group_id'];
$site_db->query($sql);
}
//Lighbox
$sql = "DELETE FROM ".LIGHTBOXES_TABLE."
WHERE user_id = $user_id";
$site_db->query($sql);
//Update Images
$sql = "UPDATE ".IMAGES_TABLE."
SET user_id = ".GUEST."
WHERE user_id = $user_id";
$site_db->query($sql);
//Update Comments
$sql = "UPDATE ".COMMENTS_TABLE."
SET user_id = ".GUEST.", user_name = '$user_name'
WHERE user_id = $user_id";
$site_db->query($sql);
//Delete User
$sql = "DELETE FROM ".USERS_TABLE."
WHERE user_id = ".$user_id."";
if($site_db->query($sql)) {
$msg = "<b>".$user_name." dein Account mit der ID: ".$user_id." wurde erfolgreich gelöscht</b>";
$site_sess->logout($user_info['user_id']);
header("Location: ".$site_sess->url(ROOT_PATH."index.php?msg=".$msg.""));
}else{
$msg = "<b>Dein Account konnte nicht gelöscht werden bitte Wende dich an einen Admin, damit der Account manuell gelöscht werden kann!!!</b>";
}
}else{
$msg= "Der Account konnte nicht gelöscht werden, da das Passwort falsch ist. Bitte versuche es noch einmal.";
}
$content = $site_template->parse_template("member_deleteaccount");
}else{
$content = $site_template->parse_template("member_deleteaccount");
}
}
erstelle eine neue .html namens member_deleteaccount.html
<form method="post" action="{url_member}" enctype="multipart/form-data" onsubmit="submit.disabled=true;">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">Account löschen</td>
</tr>
<tr>
<td class="row2">Schade, dass du uns verlassen willst!!!<p>Bitte gib aus Sicherheitsgründen dein Passwort ein:<input type="password" name="passwort" class="input" size="20"></td>
</tr>
</table>
</td>
</tr>
</table><center>
<input type="hidden" name="action" value="deleteaccount">
<input type="hidden" name="progress" value="1">
<input type="submit" name="submit" value="Account löschen :-(" class="button">
<input type="reset" name="reset" value="Doch nicht :-)" class="button"onClick="window.open('{url_home}', '_top');">
</form>
wenn du den Link "account löschen" in der user_lofininfo.html haben willst
öffne user_logininfo.html und finde
» <a href="{url_control_panel}">{lang_control_panel}</a><br />
füge danch ein:
» <a href="./member.php?action=deleteaccount">Account löschen</a><br />
falls du das in dem kontrollzentrum haben willst dann finde in der member_editprofile.html:
<form method="post" action="{url_member}" enctype="multipart/form-data">
füge davor ein:
<center><a href="./member.php?action=deleteaccount">Account löschen</a></center>
Das war alles.
Tip: wenn du das testen willst, lege vorher einen Testaccount an.
b.o.fan