Commit 738cebba authored by Dries's avatar Dries

- Moved some block up to avoid the user module duplicating data.
parent accb3067
......@@ -903,19 +903,6 @@ function user_edit($edit = array()) {
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
else if ($user->uid) {
foreach (module_list() as $module) {
if (module_hook($module, "user")) {
$result = module_invoke($module, "user", "edit_validate", $edit, $user);
}
if (is_array($result)) {
$data = array_merge($data, $result);
}
elseif (is_string($result)) {
$error = $result;
break;
}
}
/*
** If required, check that proposed passwords match. If so,
** add new password to $edit.
......@@ -947,6 +934,24 @@ function user_edit($edit = array()) {
$edit["session"] = $user->session;
}
/*
** Have the modules that extend the user information validate
** their data.
*/
foreach (module_list() as $module) {
if (module_hook($module, "user")) {
$result = module_invoke($module, "user", "edit_validate", $edit, $user);
}
if (is_array($result)) {
$data = array_merge($data, $result);
}
elseif (is_string($result)) {
$error = $result;
break;
}
}
if (!$error) {
/*
** Save user information:
......
......@@ -903,19 +903,6 @@ function user_edit($edit = array()) {
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
else if ($user->uid) {
foreach (module_list() as $module) {
if (module_hook($module, "user")) {
$result = module_invoke($module, "user", "edit_validate", $edit, $user);
}
if (is_array($result)) {
$data = array_merge($data, $result);
}
elseif (is_string($result)) {
$error = $result;
break;
}
}
/*
** If required, check that proposed passwords match. If so,
** add new password to $edit.
......@@ -947,6 +934,24 @@ function user_edit($edit = array()) {
$edit["session"] = $user->session;
}
/*
** Have the modules that extend the user information validate
** their data.
*/
foreach (module_list() as $module) {
if (module_hook($module, "user")) {
$result = module_invoke($module, "user", "edit_validate", $edit, $user);
}
if (is_array($result)) {
$data = array_merge($data, $result);
}
elseif (is_string($result)) {
$error = $result;
break;
}
}
if (!$error) {
/*
** Save user information:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment