summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/profile.module2
-rw-r--r--modules/profile/profile.module2
-rw-r--r--modules/user.module22
-rw-r--r--modules/user/user.module22
4 files changed, 40 insertions, 8 deletions
diff --git a/modules/profile.module b/modules/profile.module
index 2f1f91c94..29a528cff 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -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);
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 2f1f91c94..29a528cff 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -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);
diff --git a/modules/user.module b/modules/user.module
index 763c30540..51b31d817 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -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 {
diff --git a/modules/user/user.module b/modules/user/user.module
index 763c30540..51b31d817 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -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 {