Unsubscribe

4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 13, 2011   (RSS)

By Toledoh - June 9, 2011

Hi Guys.

I was wondering if there was a way of deleting an account, without being logged into that account.

We have the code of the edit profile page

// delete account
if (@$_POST['deleteAccount']) {
if ($CURRENT_USER['isAdmin']) { die("Error: Deleting admin accounts is not permitted!"); }

// delete uploads
$GLOBALS['tableName'] = 'accounts';
eraseRecordsUploads( $CURRENT_USER['num'] );

// 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");

// redirect to login
websiteLogin_redirectToLogin();
}

...

<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>


But I'd like people to be able to simply put in their email address and hit an "unsubscribe" button.

do-able?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Unsubscribe

By Dave - June 10, 2011

Hi Tim,

Yes, there is, but the only issue is if you know someone's email you could then erase their account. Another idea would be to let them uncheck a checkbox or change a field value but not erase the account.

Let me know what you're trying to do and/or which method you prefer and we'll get you some code.
Dave Edis - Senior Developer
interactivetools.com

Re: [Toledoh] Unsubscribe

By Dave - June 13, 2011

You could also have a look at how the reset password function works. We use a "secret key" to identify the user so they don't need to login but we still know it's them.

Another way is to let the user select their notifications without login and then send them an email to confirm.

In the end, the user experience issues usually end up being more tricky than the programming ones. :)
Dave Edis - Senior Developer
interactivetools.com