]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
UNDO: move profile update to front
authorEvan Prodromou <evan@controlezvous.ca>
Sun, 22 Jun 2008 16:49:28 +0000 (12:49 -0400)
committerEvan Prodromou <evan@controlezvous.ca>
Sun, 22 Jun 2008 16:49:28 +0000 (12:49 -0400)
darcs-hash:20080622164928-34904-04e381d2ac562a31fb3ed3dce300e2c2c456b0d7.gz

actions/profilesettings.php

index ca17e2323c4bbb4bc431d2e1839ee00f4fb8557e..85e7bd19fecced9275736a980d7f9e7e1e2fc061 100644 (file)
@@ -113,30 +113,6 @@ class ProfilesettingsAction extends SettingsAction {
 
                $user->query('BEGIN');
 
-               $profile = $user->getProfile();
-
-               $orig_profile = clone($profile);
-
-               $profile->nickname = $nickname;
-               $profile->fullname = $fullname;
-               $profile->homepage = $homepage;
-               $profile->bio = $bio;
-               $profile->location = $location;
-               $profile->profileurl = common_profile_url($nickname);
-
-               common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
-               common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
-               
-               $result = $profile->update($orig_profile);
-               
-               if (!$result) {
-                       common_log_db_error($profile, 'UPDATE', __FILE__);
-                       common_server_error(_t('Couldnt save profile.'));
-                       return;
-               }
-
-               # Keys don't update correctly, so we have to handle them separately
-               
                if (strcmp($user->nickname, $nickname) != 0) {
                        
                        common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname,
@@ -184,6 +160,28 @@ class ProfilesettingsAction extends SettingsAction {
                                                                 $email);
                }
                
+               $profile = $user->getProfile();
+
+               $orig_profile = clone($profile);
+
+               $profile->nickname = $user->nickname;
+               $profile->fullname = $fullname;
+               $profile->homepage = $homepage;
+               $profile->bio = $bio;
+               $profile->location = $location;
+               $profile->profileurl = common_profile_url($nickname);
+
+               common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
+               common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
+               
+               $result = $profile->update($orig_profile);
+               
+               if (!$result) {
+                       common_log_db_error($profile, 'UPDATE', __FILE__);
+                       common_server_error(_t('Couldnt save profile.'));
+                       return;
+               }
+
                $user->query('COMMIT');
 
                common_broadcast_profile($profile);