summaryrefslogtreecommitdiff
path: root/modules/profile/profile.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-06-10 19:21:05 +0000
committerDries Buytaert <dries@buytaert.net>2003-06-10 19:21:05 +0000
commit75a44994cd33c8832e2f0779a745a273a9cb2ed8 (patch)
treee0767d773f1898ab544e09fd23a7bf1266ccda75 /modules/profile/profile.module
parentcf5a17ca0dc9f24f913b54ea87fc6ba23c0a355d (diff)
downloadbrdo-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.
Diffstat (limited to 'modules/profile/profile.module')
-rw-r--r--modules/profile/profile.module13
1 files changed, 6 insertions, 7 deletions
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"]);