diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-06-10 19:21:05 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-06-10 19:21:05 +0000 |
commit | 75a44994cd33c8832e2f0779a745a273a9cb2ed8 (patch) | |
tree | e0767d773f1898ab544e09fd23a7bf1266ccda75 | |
parent | cf5a17ca0dc9f24f913b54ea87fc6ba23c0a355d (diff) | |
download | brdo-75a44994cd33c8832e2f0779a745a273a9cb2ed8.tar.gz brdo-75a44994cd33c8832e2f0779a745a273a9cb2ed8.tar.bz2 |
- Bugfix: an administrator could not edit the avator through the admin interface because it used the global $user object inside its functions rather then the user to be edited. Patch by Matt Westgate.
-rw-r--r-- | modules/profile.module | 13 | ||||
-rw-r--r-- | modules/profile/profile.module | 13 |
2 files changed, 12 insertions, 14 deletions
diff --git a/modules/profile.module b/modules/profile.module index 032a0d86b..26a4c9145 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -84,13 +84,13 @@ function profile_user($type, $edit, &$user) { return _profile_form($edit, "register"); case "register_validate": // validate first registration form - return _profile_validate($edit, "required"); + return _profile_validate($edit, "required", $user); case "edit_form": // when user tries to edit his own data return _profile_form(object2array($user), "private"); case "edit_validate": // validate user data editing - return _profile_validate($edit, "private"); + return _profile_validate($edit, "private", $user); case "view_public": // when others look at user data return _profile_user_view($user, "public"); @@ -136,9 +136,9 @@ function _profile_form($edit, $mode) { return $output; } -function _profile_validate($edit, $mode) { +function _profile_validate($edit, $mode, $user) { - global $profile_fields, $user; + global $profile_fields; $enabled_fields = _profile_active_fields($mode); @@ -146,7 +146,7 @@ function _profile_validate($edit, $mode) { $error .= $birth_error."<br />"; } - if (in_array("avatar", $enabled_fields) && ($avatar_error = _profile_validate_avatar($edit))) { + if (in_array("avatar", $enabled_fields) && ($avatar_error = _profile_validate_avatar($edit, $user))) { $error .= $avatar_error."<br />"; } @@ -209,8 +209,7 @@ function _profile_user_view(&$user, $mode) { return $output; } -function _profile_validate_avatar(&$edit) { - global $user; +function _profile_validate_avatar(&$edit, $user) { // check that uploaded file is an image, with a maximum file size and maximum height/width unset($edit["profile_avatar"]); diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 032a0d86b..26a4c9145 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -84,13 +84,13 @@ function profile_user($type, $edit, &$user) { return _profile_form($edit, "register"); case "register_validate": // validate first registration form - return _profile_validate($edit, "required"); + return _profile_validate($edit, "required", $user); case "edit_form": // when user tries to edit his own data return _profile_form(object2array($user), "private"); case "edit_validate": // validate user data editing - return _profile_validate($edit, "private"); + return _profile_validate($edit, "private", $user); case "view_public": // when others look at user data return _profile_user_view($user, "public"); @@ -136,9 +136,9 @@ function _profile_form($edit, $mode) { return $output; } -function _profile_validate($edit, $mode) { +function _profile_validate($edit, $mode, $user) { - global $profile_fields, $user; + global $profile_fields; $enabled_fields = _profile_active_fields($mode); @@ -146,7 +146,7 @@ function _profile_validate($edit, $mode) { $error .= $birth_error."<br />"; } - if (in_array("avatar", $enabled_fields) && ($avatar_error = _profile_validate_avatar($edit))) { + if (in_array("avatar", $enabled_fields) && ($avatar_error = _profile_validate_avatar($edit, $user))) { $error .= $avatar_error."<br />"; } @@ -209,8 +209,7 @@ function _profile_user_view(&$user, $mode) { return $output; } -function _profile_validate_avatar(&$edit) { - global $user; +function _profile_validate_avatar(&$edit, $user) { // check that uploaded file is an image, with a maximum file size and maximum height/width unset($edit["profile_avatar"]); |