Commit 7e017fce authored by Kjartan's avatar Kjartan
Browse files

- Applied patch #6552: Put back register_form and register_validate callbacks in user.module.

- Fixed bug #7406: User delete hook incorrect params.
parent 297c552c
......@@ -202,7 +202,7 @@ function profile_user($type, $edit, &$user) {
return profile_save_profile($edit, $user);
case 'view':
return profile_view_profile($user);
case 'edit':
case 'form':
return profile_edit_profile($edit, $user);
case 'validate':
return profile_validate_profile($edit);
......
......@@ -202,7 +202,7 @@ function profile_user($type, $edit, &$user) {
return profile_save_profile($edit, $user);
case 'view':
return profile_view_profile($user);
case 'edit':
case 'form':
return profile_edit_profile($edit, $user);
case 'validate':
return profile_validate_profile($edit);
......
......@@ -900,7 +900,21 @@ function user_register($edit = array()) {
$error = t("Public registrations have been disabled by the site administrator.");
}
else {
$success = true;
foreach (module_list() as $module) {
if (module_hook($module, 'user')) {
$result = module_invoke($module, 'user', 'validate', $edit, $user);
if (is_array($result)) {
$data = array_merge($data, $result);
}
elseif (is_string($result)) {
$error = $result;
break;
}
}
}
if (!$error) {
$success = true;
}
}
}
......@@ -966,6 +980,7 @@ function user_register($edit = array()) {
}
$output .= form_textfield(t("Username"), 'name', $edit['name'], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed."));
$output .= form_textfield(t("E-mail address"), "mail", $edit['mail'], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
$output .= _user_profile($edit, $edit);
$output .= form_submit(t("Create new account"));
$items[] = l(t("Request new password"), "user/password");
$items[] = l(t("Log in"), "user/login");
......@@ -1099,7 +1114,7 @@ function user_edit($edit = array()) {
function _user_profile($edit, $account) {
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', 'edit', $edit, $account)) {
if ($data = module_invoke($module, 'user', 'form', $edit, $account)) {
foreach ($data as $title => $form) {
$groups[$title] .= $form;
}
......@@ -1316,6 +1331,7 @@ function user_admin_create($edit = array()) {
$output = form_textfield(t("Username"), 'name', $edit['name'], 30, 55, t("Provide the username of the new account."));
$output .= form_textfield(t("E-mail address"), "mail", $edit['mail'], 30, 55, t("Provide the e-mail address associated with the new account."));
$output .= _user_profile($edit, $edit);
$output .= form_textfield(t("Password"), 'pass', $edit['pass'], 30, 55, t("Provide a password for the new account."));
$output .= form_submit(t("Create account"));
......@@ -1590,7 +1606,7 @@ function user_admin_edit($edit = array()) {
db_query("DELETE FROM {users} WHERE uid = %d", $account->uid);
db_query("DELETE FROM {authmap} WHERE uid = %d", $account->uid);
drupal_set_message(t("the account has been deleted."));
module_invoke_all('user', 'delete', $account, $user);
module_invoke_all('user', 'delete', $edit, $account);
return user_admin_account();
}
else {
......
......@@ -900,7 +900,21 @@ function user_register($edit = array()) {
$error = t("Public registrations have been disabled by the site administrator.");
}
else {
$success = true;
foreach (module_list() as $module) {
if (module_hook($module, 'user')) {
$result = module_invoke($module, 'user', 'validate', $edit, $user);
if (is_array($result)) {
$data = array_merge($data, $result);
}
elseif (is_string($result)) {
$error = $result;
break;
}
}
}
if (!$error) {
$success = true;
}
}
}
......@@ -966,6 +980,7 @@ function user_register($edit = array()) {
}
$output .= form_textfield(t("Username"), 'name', $edit['name'], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed."));
$output .= form_textfield(t("E-mail address"), "mail", $edit['mail'], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
$output .= _user_profile($edit, $edit);
$output .= form_submit(t("Create new account"));
$items[] = l(t("Request new password"), "user/password");
$items[] = l(t("Log in"), "user/login");
......@@ -1099,7 +1114,7 @@ function user_edit($edit = array()) {
function _user_profile($edit, $account) {
foreach (module_list() as $module) {
if ($data = module_invoke($module, 'user', 'edit', $edit, $account)) {
if ($data = module_invoke($module, 'user', 'form', $edit, $account)) {
foreach ($data as $title => $form) {
$groups[$title] .= $form;
}
......@@ -1316,6 +1331,7 @@ function user_admin_create($edit = array()) {
$output = form_textfield(t("Username"), 'name', $edit['name'], 30, 55, t("Provide the username of the new account."));
$output .= form_textfield(t("E-mail address"), "mail", $edit['mail'], 30, 55, t("Provide the e-mail address associated with the new account."));
$output .= _user_profile($edit, $edit);
$output .= form_textfield(t("Password"), 'pass', $edit['pass'], 30, 55, t("Provide a password for the new account."));
$output .= form_submit(t("Create account"));
......@@ -1590,7 +1606,7 @@ function user_admin_edit($edit = array()) {
db_query("DELETE FROM {users} WHERE uid = %d", $account->uid);
db_query("DELETE FROM {authmap} WHERE uid = %d", $account->uid);
drupal_set_message(t("the account has been deleted."));
module_invoke_all('user', 'delete', $account, $user);
module_invoke_all('user', 'delete', $edit, $account);
return user_admin_account();
}
else {
......
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