From e2b4d48ab49fb64ddb718c97850e0e9df2d00d94 Mon Sep 17 00:00:00 2001
From: David Anderson <davea@ssl.berkeley.edu>
Date: Sun, 10 Apr 2011 15:23:42 +0000
Subject: [PATCH] - user web: fix "delete profile" function

svn path=/trunk/boinc/; revision=23359
---
 checkin_notes                |  9 +++++++++
 html/inc/profile.inc         |  2 +-
 html/user/delete_profile.php | 12 ++++--------
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/checkin_notes b/checkin_notes
index befa4b1393..cefa7e3009 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 d2b6a765b5..074c208f8e 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 b69d506576..2e15c661ea 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();
 }
 
-- 
GitLab