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: [Dave] Unsubscribe

By Toledoh - June 10, 2011

Hi Dave,

I was hoping to stop the need for people to "log in" but maybe I do just set up a basic login / edit profile page where they can unsubscribe from certain notifications.... Thinking more about it, I'll need the log in function on the site down the track, so may as well implement it now.

Thanks!
Cheers,

Tim (toledoh.com.au)