";
+ $title = t("Check username");
}
-
- $output .= "$message";
+ $output .= form_textfield($title, "mask", $edit["test"], 32, 64). form_submit(t("Check"));
return form($output);
}
@@ -1594,32 +1577,27 @@ function user_admin_edit($edit = array()) {
}
function user_admin_account() {
- $query = arg(3);
-
- $queries[] = "";
- $queries[] = "WHERE u.status = 0";
- foreach (user_roles(1) as $key => $value) {
- $queries[] = "WHERE r.name = '$value'";
- }
-
- $sql = "SELECT u.uid, u.name, u.timestamp FROM {role} r INNER JOIN {users} u ON r.rid = u.rid ". $queries[$query ? $query : 0];
$header = array(
- array ("data" => t("uid"), "field" => "u.uid"),
+ array ("data" => t("ID"), "field" => "u.uid"),
array ("data" => t("username"), "field" => "u.name"),
+ array ("data" => t("status"), "field" => "u.status"),
+ array ("data" => t("role"), "field" => "u.rid"),
array ("data" => t("last access"), "field" => "u.timestamp", "sort" => "desc"),
t("operations")
);
+ $sql = "SELECT u.uid, u.name, u.status, u.timestamp, r.name AS rolename FROM {role} r INNER JOIN {users} u ON r.rid = u.rid ";
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50);
+ $status = array (t("blocked"), t("active"));
while ($account = db_fetch_object($result)) {
- $rows[] = array($account->uid, format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
+ $rows[] = array($account->uid, format_name($account), $status[$account->status], $account->rolename, format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
}
$pager = pager_display(NULL, 50, 0, "admin", tablesort_pager());
if (!empty($pager)) {
- $rows[] = array(array("data" => $pager, "colspan" => 4));
+ $rows[] = array(array("data" => $pager, "colspan" => 6));
}
return table($header, $rows);
}
@@ -1659,11 +1637,12 @@ function user_admin() {
case t("Add rule"):
case t("Check"):
case "access":
- $output = user_admin_access($edit);
+ $output .= user_admin_access($edit);
break;
case t("Save permissions"):
+ $output = status(t("User permissions saved."));
case "permission":
- $output = user_admin_perm($edit);
+ $output .= user_admin_perm($edit);
break;
case t("Create account"):
case "create":
@@ -1672,8 +1651,9 @@ function user_admin() {
case t("Add role"):
case t("Delete role"):
case t("Save role"):
+ $output = status(t("Your role changes were saved."));
case "role":
- $output = user_admin_role($edit);
+ $output .= user_admin_role($edit);
break;
case t("Delete account"):
case t("Save account"):
@@ -1697,32 +1677,16 @@ function user_help($section = "admin/help#user") {
switch ($section) {
case 'admin/user':
- $output .= t("Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account. Click on either the \"username\" or \"edit account\" to edit a user's information.");
+ $output .= t("
Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account.
");
+ $output .= t("
Click on either the username or edit account to edit a user's information.
");
+ $output .= t("
Sort accounts by registration time by clicking on the ID header
");
break;
case 'admin/user/create':
case 'admin/user/account/create':
$output .= t("This web page allows the administrators to register a new users by hand. Note:
You cannot have a user where either the e-mail address or the username match another user in the system.
");
break;
- case (preg_match("/^admin\/user\/account.*/i", $section) ? $section : !$section):
- $output .= t("This page allows you to review and edit %role-name. To edit a profile click on either the \"username\" or \"edit account\".");
-
- $role = substr(strrchr($section, "/"), 1);
-
- if ($role == "account") {
- $replace = t("any user's profile");
- }
- else if ($role == "1") {
- $replace = t("a blocked user's profile");
- }
- else {
- $output = strtr($output, array("%role-name" => t("a user with the '%role-name' role")));
- $role_names = user_roles(1);
- $replace = $role_names[$role];
- }
- $output = strtr($output, array("%role-name" => $replace));
- break;
case 'admin/user/access':
- $output .= t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on %e-mail, for the username mask click on %username.", array("%e-mail" => l(t("e-mail rules"), "admin/user/access/mail"), "%username" => l(t("username rules"), "admin/user/access/user")));
+ $output .= t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on %e-mail, for the username mask click on %username.", array("%e-mail" => l(t("e-mail rules"), "admin/user/access/mail"), "%username" => l(t("name rules"), "admin/user/access/user")));
break;
case 'admin/user/access/mail':
$output .= t("Setup and test the e-mail access rules. The access function checks if you match a deny and not an allow. If you match only a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern. Notes:
To delete a rule click on \"delete rule\".
The order of the rules does not matter.
");
diff --git a/modules/user/user.module b/modules/user/user.module
index 000524eb478..6537ea99c46 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -490,7 +490,7 @@ function user_link($type) {
$links = array();
if ($type == "page") {
- $links[] = l(t("user account"), "user", array("title" => t("Create a user account, request a new password or edit your account settings.")));
+ $links[] = l(t("my account"), "user", array("title" => t("Create a user account, request a new password or edit your account settings.")));
}
if ($type == "system") {
@@ -502,21 +502,14 @@ function user_link($type) {
if (user_access("administer users")) {
menu("admin/user", t("accounts"), "user_admin", 2);
menu("admin/user/create", t("new user"), "user_admin", 1);
- menu("admin/user/account", t("users"), "user_admin", 2);
menu("admin/user/access", t("access rules"), NULL, 3);
- menu("admin/user/access/mail", t("by e-mail"), "user_admin");
- menu("admin/user/access/user", t("by name"), "user_admin");
+ menu("admin/user/access/mail", t("e-mail rules"), "user_admin");
+ menu("admin/user/access/user", t("name rules"), "user_admin");
menu("admin/user/role", t("roles"), "user_admin", 4);
menu("admin/user/permission", t("permissions"), "user_admin", 5);
menu("admin/user/search", t("search"), "user_admin", 8);
menu("admin/user/help", t("help"), "user_help", 9);
menu("admin/user/edit", t("edit user account"), "user_admin", 0, 1); // hidden menu
- menu("admin/user/account/1", t("blocked users"), "user_admin", 3);
-
- $i = 2;
- foreach (user_roles(1) as $key => $value) {
- menu("admin/user/account/$i", t("users with role '%role'", array("%role" => $value)), "user_admin", 4);
- }
}
}
@@ -1050,7 +1043,7 @@ function user_edit($edit = array()) {
$user = user_save($user, array_merge($edit, $data));
- $output .= t("Your user information changes have been saved.");
+ $output .= status(t("Your user information changes have been saved."));
}
}
}
@@ -1302,57 +1295,47 @@ function user_admin_access($edit = array()) {
return;
}
- if ($type == "mail") {
- $output .= "
". t("E-mail rules") ."
";
- }
-
- if ($type == "user") {
- $output .= "
". t("Username rules") ."
";
- }
-
if ($op == t("Add rule")) {
db_query("INSERT INTO {access} (mask, type, status) VALUES ('%s', '%s', %d)", $edit["mask"], $type, $edit["status"]);
+ $output .= status(t("Access rule added"));
}
else if ($op == t("Check")) {
if (user_deny($type, $edit["test"])) {
- $message = "'". $edit["test"] ."' is not allowed.";
+ $output .= status(t("%test is not allowed.", array ("%test" => $edit["test"])));
}
else {
- $message = "'". $edit["test"] ."' is allowed.";
+ $output .= status(t("%test is allowed.", array ("%test" => $edit["test"])));
}
}
else if ($id) {
db_query("DELETE FROM {access} WHERE aid = %d", $id);
+ $output .= status(t("Access rule deleted"));
}
$header = array(t("type"), t("mask"), t("operations"));
-
$result = db_query("SELECT * FROM {access} WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
-
while ($rule = db_fetch_object($result)) {
$rows[] = array(t("Allow"), $rule->mask, array("data" => l(t("delete rule"), "admin/user/access/$type/$rule->aid"), "align" => "center"));
}
$result = db_query("SELECT * FROM {access} WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
-
while ($rule = db_fetch_object($result)) {
$rows[] = array(t("Deny"), $rule->mask, l(t("delete rule"), "admin/user/access/$type/$rule->aid"));
}
- $rows[] = array("", "", "");
-
+ $options = array ("1" => t("Allow"), "0" => t("Deny"));
+ $rows[] = array(form_select(NUll, "status", $edit["status"], $options), form_textfield(NULL, "mask", $edit["mask"], 32, 64), form_submit(t("Add rule")));
$output .= table($header, $rows);
$output .= "
%: ". t("Matches any number of characters, even zero characters") .". _: ". t("Matches exactly one character.") ."
";
+ $title = t("Check username");
}
-
- $output .= "$message";
+ $output .= form_textfield($title, "mask", $edit["test"], 32, 64). form_submit(t("Check"));
return form($output);
}
@@ -1594,32 +1577,27 @@ function user_admin_edit($edit = array()) {
}
function user_admin_account() {
- $query = arg(3);
-
- $queries[] = "";
- $queries[] = "WHERE u.status = 0";
- foreach (user_roles(1) as $key => $value) {
- $queries[] = "WHERE r.name = '$value'";
- }
-
- $sql = "SELECT u.uid, u.name, u.timestamp FROM {role} r INNER JOIN {users} u ON r.rid = u.rid ". $queries[$query ? $query : 0];
$header = array(
- array ("data" => t("uid"), "field" => "u.uid"),
+ array ("data" => t("ID"), "field" => "u.uid"),
array ("data" => t("username"), "field" => "u.name"),
+ array ("data" => t("status"), "field" => "u.status"),
+ array ("data" => t("role"), "field" => "u.rid"),
array ("data" => t("last access"), "field" => "u.timestamp", "sort" => "desc"),
t("operations")
);
+ $sql = "SELECT u.uid, u.name, u.status, u.timestamp, r.name AS rolename FROM {role} r INNER JOIN {users} u ON r.rid = u.rid ";
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50);
+ $status = array (t("blocked"), t("active"));
while ($account = db_fetch_object($result)) {
- $rows[] = array($account->uid, format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
+ $rows[] = array($account->uid, format_name($account), $status[$account->status], $account->rolename, format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
}
$pager = pager_display(NULL, 50, 0, "admin", tablesort_pager());
if (!empty($pager)) {
- $rows[] = array(array("data" => $pager, "colspan" => 4));
+ $rows[] = array(array("data" => $pager, "colspan" => 6));
}
return table($header, $rows);
}
@@ -1659,11 +1637,12 @@ function user_admin() {
case t("Add rule"):
case t("Check"):
case "access":
- $output = user_admin_access($edit);
+ $output .= user_admin_access($edit);
break;
case t("Save permissions"):
+ $output = status(t("User permissions saved."));
case "permission":
- $output = user_admin_perm($edit);
+ $output .= user_admin_perm($edit);
break;
case t("Create account"):
case "create":
@@ -1672,8 +1651,9 @@ function user_admin() {
case t("Add role"):
case t("Delete role"):
case t("Save role"):
+ $output = status(t("Your role changes were saved."));
case "role":
- $output = user_admin_role($edit);
+ $output .= user_admin_role($edit);
break;
case t("Delete account"):
case t("Save account"):
@@ -1697,32 +1677,16 @@ function user_help($section = "admin/help#user") {
switch ($section) {
case 'admin/user':
- $output .= t("Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account. Click on either the \"username\" or \"edit account\" to edit a user's information.");
+ $output .= t("
Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account.
");
+ $output .= t("
Click on either the username or edit account to edit a user's information.
");
+ $output .= t("
Sort accounts by registration time by clicking on the ID header
");
break;
case 'admin/user/create':
case 'admin/user/account/create':
$output .= t("This web page allows the administrators to register a new users by hand. Note:
You cannot have a user where either the e-mail address or the username match another user in the system.
");
break;
- case (preg_match("/^admin\/user\/account.*/i", $section) ? $section : !$section):
- $output .= t("This page allows you to review and edit %role-name. To edit a profile click on either the \"username\" or \"edit account\".");
-
- $role = substr(strrchr($section, "/"), 1);
-
- if ($role == "account") {
- $replace = t("any user's profile");
- }
- else if ($role == "1") {
- $replace = t("a blocked user's profile");
- }
- else {
- $output = strtr($output, array("%role-name" => t("a user with the '%role-name' role")));
- $role_names = user_roles(1);
- $replace = $role_names[$role];
- }
- $output = strtr($output, array("%role-name" => $replace));
- break;
case 'admin/user/access':
- $output .= t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on %e-mail, for the username mask click on %username.", array("%e-mail" => l(t("e-mail rules"), "admin/user/access/mail"), "%username" => l(t("username rules"), "admin/user/access/user")));
+ $output .= t("Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on %e-mail, for the username mask click on %username.", array("%e-mail" => l(t("e-mail rules"), "admin/user/access/mail"), "%username" => l(t("name rules"), "admin/user/access/user")));
break;
case 'admin/user/access/mail':
$output .= t("Setup and test the e-mail access rules. The access function checks if you match a deny and not an allow. If you match only a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern. Notes: