diff --git a/server/apps/users/forms.py b/server/apps/users/forms.py
index d965b9a9..275ad71e 100644
--- a/server/apps/users/forms.py
+++ b/server/apps/users/forms.py
@@ -114,3 +114,7 @@ class UserProfileForm(forms.Form):
widget=forms.CheckboxInput(attrs={"class": "custom-control-input"}))
profile_submitted.group = "hidden"
+class UserProfileDeleteForm(forms.Form):
+ delete_oh_data = forms.BooleanField(label = "Delete your stories from OpenHumans",
+ required=False,
+ widget=forms.CheckboxInput(attrs={"class": "custom-control-input"}))
diff --git a/server/apps/users/helpers.py b/server/apps/users/helpers.py
index fbd96ef0..c9b3f1be 100644
--- a/server/apps/users/helpers.py
+++ b/server/apps/users/helpers.py
@@ -1,5 +1,6 @@
from django.contrib.auth.models import User
from .models import UserProfile
+from server.apps.main.models import PublicExperience
def user_profile_exists(user):
"""
@@ -53,3 +54,23 @@ def get_user_profile(user):
except UserProfile.DoesNotExist:
uo = None
return uo
+
+def delete_user(user, delete_oh_data):
+ """
+ Deletes the user and all data associated with it.
+
+ Args:
+ delete_oh_data: True if stories on OpenHumans should also be deleted
+
+ Returns:
+ None
+ """
+ ohmember = user.openhumansmember
+
+ # Delete the stories from the OpenHumans database
+ if delete_oh_data:
+ ohmember.delete_all_files()
+
+ # Delete the actual user
+ user.delete()
+
diff --git a/server/apps/users/templates/users/delete.html b/server/apps/users/templates/users/delete.html
new file mode 100644
index 00000000..f2744e18
--- /dev/null
+++ b/server/apps/users/templates/users/delete.html
@@ -0,0 +1,44 @@
+{% extends 'main/application.html' %}
+
+{% block title %}AutSPACEs - {{title}} {% endblock %}
+
+{% load static %}
+{% load custom_tags %}
+{% load humanize %}
+
+{% block content %}
+
+
+