Website Membership - Un-subscribe

By Toledoh - February 19, 2010

Hi Guys,

Is there a way we can add a "delete account" or "unsubscribe" to the edit profile page?

Cheers,
Tim
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Website Membership - Un-subscribe

By Dave - February 19, 2010

Hi Tim,

Yes, I could write up some docs for that. Will the user want to be able to re-activate their account later or do you want to permanently delete it?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Website Membership - Un-subscribe

By Toledoh - February 19, 2010

Hi Dave.

I think that the ability to remove themselves from the database would be good. This will cover our SPAM regulations here in Aust. They can always re subsribe at a later stage.

Cheers.
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Website Membership - Un-subscribe

By Dave - February 22, 2010

Hi Tim,

Do you want it to be one-click unsubscribe? Or maybe with a javascript confirm popup?

The simplest and fastest would be if you can email me CMS & FTP login details, the url of the profile page, and this forum thread. I'll just do it for you quick and post the code back here. Make sure you add a unsubscribe link to the page first.

Let me know if that works for you.

Note: Email me directly, don't post login details to the forum (I always have to say this or people post login details the forum).
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Website Membership - Un-subscribe

By avrom - February 24, 2010

Hi Dave,

Yes an unsubscribe feature would be essential, people could just login and remove the account themselves. For the next release ?

Cheers
Avrom

Re: [Toledoh] Website Membership - Un-subscribe

By Dave - February 24, 2010

Hi Tim,

Try adding this at the top of profile.php just before the closing ?> php tag:

// 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();
}


And then this at the bottom _below_ the closing </form> tag:

<!-- REMOVE PROFILE FORM -->
<div style="border: 1px solid #000; background-color: #EEE; padding: 20px; width: 500px">
<b>Delete Account</b>
<p>If you want to delete your account you can do so here.<br/>
Please note that all data will be lost and this is irreversible.</p>

<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>
</div>
<!-- /REMOVE PROFILE FORM -->


Get it working first, then you can re-style it however you need.

Hope that helps! Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [virgodesign] Website Membership - Un-subscribe

By Dave - February 24, 2010

Avrom,

See the above post and let me know if you have any other questions.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Website Membership - Un-subscribe

By Toledoh - February 24, 2010

As expected - works perfectly thanks Dave!
Cheers,

Tim (toledoh.com.au)