Re: [nmsinc] Erase Record Outside CMS
Hi Ray,
The membership plugin uses the following to delete an account. it may give some ideas.
That said, the ability to delete records is an
extremely dangerous function to put in a viewer.
You might want to consider giving the user the ability to set a "hidden" checkbox to hide records from the site instead of allowing them to actually delete records.
You could also use a modification of the alertSavedRecord plugin to send an email to the admin when a record was hidden. You can find the alertSavedRecord plugin
IN THIS POST // delete account
if (@$_POST['deleteAccount']) {
if ($CURRENT_USER['isAdmin']) { die("Error: Deleting admin accounts is not permitted!"); }
// delete account
$query = mysql_escapef("DELETE FROM `{$TABLE_PREFIX}accounts` WHERE num = ?", $CURRENT_USER['num']);
mysql_query($query) or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
And
<form method="post" action="?" onsubmit="return confirm('Are you sure you want to delete your account?')">
<input type="submit" name="deleteAccount" value="Delete Account" />
</form>
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php