summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module55
1 files changed, 9 insertions, 46 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 15efff2fe..56a2326f4 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -496,9 +496,11 @@ function user_link($type) {
if ($type == "system") {
global $user;
if ($user->uid) {
- menu("user/edit", t("my account"), "user_page", 8);
+ menu("user", t("my account"), "user_page", 8);
+ menu("user/edit", t("edit account"), "user_page", 0);
menu("user/logout", t("log out"), "user_page", 10);
}
+
if (user_access("administer users")) {
menu("admin/user", t("accounts"), "user_admin", 2);
menu("admin/user/create", t("new user"), "user_admin", 1);
@@ -951,26 +953,6 @@ function user_register($edit = array()) {
return form($output);
}
-
-function user_delete() {
- global $user;
-
- $edit = $_POST["edit"];
-
- if ($edit["confirm"]) {
- watchdog("user", "$user->name deactivated her own account.");
- db_query("UPDATE {users} SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid);
- $output .= t("Your account has been deactivated.");
- }
- else {
- $output .= form_item(t("Confirm Deletion"), t("You are about to deactivate your own user account. In addition, your e-mail address will be removed from the database."));
- $output .= form_hidden("confirm", 1);
- $output .= form_submit(t("Delete account"));
- $output = form($output);
- }
- return $output;
-}
-
function user_edit($edit = array()) {
global $user;
@@ -1075,16 +1057,6 @@ function user_edit($edit = array()) {
return $output;
}
-function user_menu() {
- global $theme;
-
- $links[] = l(t("view user information"), "user/view");
- $links[] = l(t("edit user information"), "user/edit");
- $links[] = l(t("delete account"), "user/delete");
-
- return "<div class=\"user-page-menu\">". theme("links", $links) ."</div>";
-}
-
function user_view($uid = 0) {
global $user;
@@ -1099,7 +1071,6 @@ function user_view($uid = 0) {
$output .= implode("\n", module_invoke_all("user", "view_private", "", $user));
theme("header", $user->name);
- theme("box", t("User account"), user_menu());
theme("box", $user->name, $output);
theme("footer");
}
@@ -1163,20 +1134,11 @@ function user_page() {
theme("box", t("Log in"), $output);
theme("footer");
break;
- case t("Delete account"):
- case "delete":
- $output = user_delete();
- theme("header", t("Delete account"));
- theme("box", t("User account"), user_menu());
- theme("box", t("Delete account"), $output);
- theme("footer");
- break;
case t("Save user information"):
case "edit":
$output = user_edit($edit);
$GLOBALS["theme"] = theme_init();
theme("header", t("Edit user information"));
- theme("box", t("User account"), user_menu());
theme("box", t("Edit user information"), $output);
theme("footer");
break;
@@ -1493,9 +1455,6 @@ function user_admin_edit($edit = array()) {
}
// TODO: this display/edit/validate should be moved to a new profile module implementing the _user hooks
- if ($error) {
- // do nothing
- }
if ($error = user_validate_name($edit["name"])) {
// do nothing
}
@@ -1526,7 +1485,7 @@ function user_admin_edit($edit = array()) {
unset($edit["pass1"], $edit["pass2"]);
if (!$error) {
$account = user_save($account, array_merge($edit, $data));
- $output .= status(t("your user information changes have been saved."));
+ $output .= status(t("user information changes have been saved."));
}
else {
$output .= theme("theme_error", $error);
@@ -1544,6 +1503,10 @@ function user_admin_edit($edit = array()) {
}
}
+ if (!$edit) {
+ $edit = object2array($account);
+ }
+
/*
** Display user form:
*/
@@ -1692,7 +1655,7 @@ function user_help($section = "admin/help#user") {
$output .= t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the %role). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => l(t("user roles page"), "admin/user/role")));
break;
case 'admin/user/role':
- $output .= "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles:";
+ $output .= "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\".<br />By default, Drupal comes with two user roles:";
$output .= "<ul>";
$output .= "<li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li>";
$output .= "<li>Authenticated user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li>";