Erase Record Outside CMS

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 2, 2012   (RSS)

Re: [nmsinc] Erase Record Outside CMS

By gkornbluth - August 2, 2012

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

Re: [gkornbluth] Erase Record Outside CMS

By nmsinc - August 2, 2012

Hi Jerry,

I like your idea of marking the record as a non-list. That works perfect and much better then removing it!

Thank you very - Ray
nmsinc