diff --git a/checkin_notes b/checkin_notes
index befa4b1393dbc9427d60c158a21056abf71dac7f..cefa7e3009b47b2e18e4e9717e44fda21c653509 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -2160,3 +2160,12 @@ David  8 Apr 2011
 
     tools/
         upgrade
+
+David  10 Apr 2011
+    - user web: fix "delete profile" function
+
+    html/
+        user/
+            delete_profile.php
+        inc/
+            profile.inc
diff --git a/html/inc/profile.inc b/html/inc/profile.inc
index d2b6a765b59cba5f5e5e335ccdbcd4bf7ecd30f1..074c208f8ef5af0dfe4d2b8ff61b297152767562 100644
--- a/html/inc/profile.inc
+++ b/html/inc/profile.inc
@@ -112,7 +112,7 @@ function delete_user_pictures($userid) {
 
 function delete_profile($user) {
     delete_user_pictures($user->id);
-    BoincProfile::delete_aux("userid=$user->id");
+    return BoincProfile::delete_aux("userid=$user->id");
 }
 
 function scale_image(
diff --git a/html/user/delete_profile.php b/html/user/delete_profile.php
index b69d5065767a7f00bfffb030aac089dbb33a3e24..2e15c661eaecbeae4044413960500535faf08947 100644
--- a/html/user/delete_profile.php
+++ b/html/user/delete_profile.php
@@ -22,8 +22,10 @@ require_once("../inc/profile.inc");
 
 check_get_args(array("delete"));
 
-function delete_profile($user) {
-    $result = BoincProfile::delete_aux("userid = $user->id");
+$user = get_logged_in_user();
+
+if (isset($_POST['delete']) && $_POST['delete']) {
+    $result = delete_profile($user);
     if (!$result) {
         error_page("couldn't delete profile - please try again later");
     }
@@ -32,12 +34,6 @@ function delete_profile($user) {
     $user->update("has_profile=0");
     echo "Your profile has been deleted<br>";
     page_tail();
-}
-
-$user = get_logged_in_user();
-
-if (isset($_POST['delete']) && $_POST['delete']) {
-    delete_profile($user);
     exit();
 }