Commit 097f6209 authored by Dries's avatar Dries
Browse files

- First take at improving the user module's code: replaced the custom error
  printing with calls to drupal_set_message().
parent cb7c2e09
...@@ -648,7 +648,7 @@ function user_login($edit = array(), $msg = "") { ...@@ -648,7 +648,7 @@ function user_login($edit = array(), $msg = "") {
*/ */
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
/* /*
...@@ -753,7 +753,7 @@ function user_pass($edit = array()) { ...@@ -753,7 +753,7 @@ function user_pass($edit = array()) {
// Display error message if necessary. // Display error message if necessary.
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
/* /*
...@@ -876,7 +876,7 @@ function user_register($edit = array()) { ...@@ -876,7 +876,7 @@ function user_register($edit = array()) {
} }
else { else {
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
} }
...@@ -981,7 +981,7 @@ function user_edit($edit = array()) { ...@@ -981,7 +981,7 @@ function user_edit($edit = array()) {
} }
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
if (!$edit) { if (!$edit) {
...@@ -1172,7 +1172,7 @@ function user_admin_create($edit = array()) { ...@@ -1172,7 +1172,7 @@ function user_admin_create($edit = array()) {
else { else {
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Provide the username of the new account.")); $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Provide the username of the new account."));
...@@ -1429,7 +1429,7 @@ function user_admin_edit($edit = array()) { ...@@ -1429,7 +1429,7 @@ function user_admin_edit($edit = array()) {
drupal_set_message(t("user information changes have been saved.")); drupal_set_message(t("user information changes have been saved."));
} }
else { else {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
} }
else if ($op == t("Delete account")) { else if ($op == t("Delete account")) {
...@@ -1441,7 +1441,7 @@ function user_admin_edit($edit = array()) { ...@@ -1441,7 +1441,7 @@ function user_admin_edit($edit = array()) {
} }
else { else {
$error = t("Failed to delete account: the account has to be blocked first."); $error = t("Failed to delete account: the account has to be blocked first.");
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
} }
......
...@@ -648,7 +648,7 @@ function user_login($edit = array(), $msg = "") { ...@@ -648,7 +648,7 @@ function user_login($edit = array(), $msg = "") {
*/ */
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
/* /*
...@@ -753,7 +753,7 @@ function user_pass($edit = array()) { ...@@ -753,7 +753,7 @@ function user_pass($edit = array()) {
// Display error message if necessary. // Display error message if necessary.
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
/* /*
...@@ -876,7 +876,7 @@ function user_register($edit = array()) { ...@@ -876,7 +876,7 @@ function user_register($edit = array()) {
} }
else { else {
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
} }
...@@ -981,7 +981,7 @@ function user_edit($edit = array()) { ...@@ -981,7 +981,7 @@ function user_edit($edit = array()) {
} }
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
if (!$edit) { if (!$edit) {
...@@ -1172,7 +1172,7 @@ function user_admin_create($edit = array()) { ...@@ -1172,7 +1172,7 @@ function user_admin_create($edit = array()) {
else { else {
if ($error) { if ($error) {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Provide the username of the new account.")); $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Provide the username of the new account."));
...@@ -1429,7 +1429,7 @@ function user_admin_edit($edit = array()) { ...@@ -1429,7 +1429,7 @@ function user_admin_edit($edit = array()) {
drupal_set_message(t("user information changes have been saved.")); drupal_set_message(t("user information changes have been saved."));
} }
else { else {
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
} }
else if ($op == t("Delete account")) { else if ($op == t("Delete account")) {
...@@ -1441,7 +1441,7 @@ function user_admin_edit($edit = array()) { ...@@ -1441,7 +1441,7 @@ function user_admin_edit($edit = array()) {
} }
else { else {
$error = t("Failed to delete account: the account has to be blocked first."); $error = t("Failed to delete account: the account has to be blocked first.");
$output .= theme("error", $error); drupal_set_message($error, 'error');
} }
} }
......
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