diff --git a/modules/blog.module b/modules/blog.module
index 2677f8e0428e066ff81ced51c3d4151d24a9f396..f3603bc5d40bb5ec246d842a4c19d0e72c1be608 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -39,6 +39,14 @@ function blog_access($op, $node) {
}
+function blog_user($type, &$edit, &$user) {
+ switch ($type) {
+ case "view_public":
+ case "view_private":
+ return form_item("Blog", lm(t("View recent entries."), array("mod" => "blog", "id" => $user->uid)) ."
". lm(t("View all entries."), array("mod" => "blog", "id" => $user->uid, "all" => 1)));
+ }
+}
+
function blog_save($op, $node) {
if ($op == "approve") {
return array("promote" => 1);
@@ -205,12 +213,6 @@ function blog_page_last() {
function blog_form(&$node, &$help, &$error) {
global $nid, $iid;
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if (isset($node->body)) {
/*
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 2677f8e0428e066ff81ced51c3d4151d24a9f396..f3603bc5d40bb5ec246d842a4c19d0e72c1be608 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -39,6 +39,14 @@ function blog_access($op, $node) {
}
+function blog_user($type, &$edit, &$user) {
+ switch ($type) {
+ case "view_public":
+ case "view_private":
+ return form_item("Blog", lm(t("View recent entries."), array("mod" => "blog", "id" => $user->uid)) ."
". lm(t("View all entries."), array("mod" => "blog", "id" => $user->uid, "all" => 1)));
+ }
+}
+
function blog_save($op, $node) {
if ($op == "approve") {
return array("promote" => 1);
@@ -205,12 +213,6 @@ function blog_page_last() {
function blog_form(&$node, &$help, &$error) {
global $nid, $iid;
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if (isset($node->body)) {
/*
diff --git a/modules/book.module b/modules/book.module
index 055b3681eaa30b70c5597169a48dd007ebf2b4da..f6dab9d06943a568a460914eb28ebe5a0aa071b6 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -170,13 +170,7 @@ function book_delete(&$node) {
function book_form(&$node, &$help, &$error) {
global $user, $op;
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
- $output .= form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in."));
+ $output = form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in."));
if ($node->format) {
if ($op != t("Preview")) {
diff --git a/modules/book/book.module b/modules/book/book.module
index 055b3681eaa30b70c5597169a48dd007ebf2b4da..f6dab9d06943a568a460914eb28ebe5a0aa071b6 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -170,13 +170,7 @@ function book_delete(&$node) {
function book_form(&$node, &$help, &$error) {
global $user, $op;
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
- $output .= form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in."));
+ $output = form_select(t("Parent"), "parent", $node->parent, book_toc(), t("The parent subject or category the page belongs in."));
if ($node->format) {
if ($op != t("Preview")) {
diff --git a/modules/forum.module b/modules/forum.module
index 69a26b289f22a6a7f1a04e2a386020a183bcbfe2..e5b487f09e6eccad513d73a8689331d84efbadd2 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -55,12 +55,6 @@ function forum_view($node) {
function forum_form(&$node, &$help, &$error) {
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if (function_exists("taxonomy_node_form")) {
$output = implode("", taxonomy_node_form("forum", $node));
}
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 69a26b289f22a6a7f1a04e2a386020a183bcbfe2..e5b487f09e6eccad513d73a8689331d84efbadd2 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -55,12 +55,6 @@ function forum_view($node) {
function forum_form(&$node, &$help, &$error) {
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if (function_exists("taxonomy_node_form")) {
$output = implode("", taxonomy_node_form("forum", $node));
}
diff --git a/modules/node.module b/modules/node.module
index a74dacaf3548a513a47fb8cf1f8d660d6c997384..635d9a7257d3a95beb2655ed1cc990dab08f7e3b 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -892,7 +892,8 @@ function node_add($type) {
*/
if ($type && node_access("create", $type)) {
- $output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type));
+ // Initialize settings
+ $output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type, "status" => 1, "moderate" => 1, "comment" => 2));
}
else {
diff --git a/modules/node/node.module b/modules/node/node.module
index a74dacaf3548a513a47fb8cf1f8d660d6c997384..635d9a7257d3a95beb2655ed1cc990dab08f7e3b 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -892,7 +892,8 @@ function node_add($type) {
*/
if ($type && node_access("create", $type)) {
- $output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type));
+ // Initialize settings
+ $output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type, "status" => 1, "moderate" => 1, "comment" => 2));
}
else {
diff --git a/modules/page.module b/modules/page.module
index da82588885eff15766aaa9f44e6225cdeb4cf179..06762b671cc14b25cc13000f3c06e17af4ee6f46 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -129,12 +129,6 @@ function page_view($node, $main = 0) {
function page_form(&$node, &$help, &$error) {
global $op;
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if ($node->format) {
if ($op != t("Preview")) {
$node->body = addslashes($node->body);
diff --git a/modules/page/page.module b/modules/page/page.module
index da82588885eff15766aaa9f44e6225cdeb4cf179..06762b671cc14b25cc13000f3c06e17af4ee6f46 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -129,12 +129,6 @@ function page_view($node, $main = 0) {
function page_form(&$node, &$help, &$error) {
global $op;
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if ($node->format) {
if ($op != t("Preview")) {
$node->body = addslashes($node->body);
diff --git a/modules/poll.module b/modules/poll.module
index 2bfdd7d0d3570b670374acd870bae1c0bd89cc36..68b54eb586c0cce2d56ba7199c218a3a25fe1a7d 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -40,12 +40,6 @@ function poll_delete($node) {
}
function poll_form(&$node, &$help, &$error) {
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
$admin = user_access("administer nodes");
$_duration = array(0 => t("Unlimited"), 86400 => format_interval(86400), 172800 => format_interval(172800), 345600 => format_interval(345600), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 4838400 => format_interval(4838400), 9676800 => format_interval(9676800), 31536000 => format_interval(31536000));
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 2bfdd7d0d3570b670374acd870bae1c0bd89cc36..68b54eb586c0cce2d56ba7199c218a3a25fe1a7d 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -40,12 +40,6 @@ function poll_delete($node) {
}
function poll_form(&$node, &$help, &$error) {
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
$admin = user_access("administer nodes");
$_duration = array(0 => t("Unlimited"), 86400 => format_interval(86400), 172800 => format_interval(172800), 345600 => format_interval(345600), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 4838400 => format_interval(4838400), 9676800 => format_interval(9676800), 31536000 => format_interval(31536000));
diff --git a/modules/story.module b/modules/story.module
index 5c84baa0db1d6b49b2016c91b564995b2bbb42e9..f4366d0cb07ae8492fa19de23be2c4f6a5211b1e 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -65,12 +65,6 @@ function story_link($type) {
function story_form(&$node, &$help, &$error) {
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if (isset($node->body)) {
/*
diff --git a/modules/story/story.module b/modules/story/story.module
index 5c84baa0db1d6b49b2016c91b564995b2bbb42e9..f4366d0cb07ae8492fa19de23be2c4f6a5211b1e 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -65,12 +65,6 @@ function story_link($type) {
function story_form(&$node, &$help, &$error) {
- if (!$node->status) {
- $node->status = 1;
- $node->moderate = 1;
- $node->comment = 2;
- }
-
if (isset($node->body)) {
/*
diff --git a/modules/user.module b/modules/user.module
index 8a54366c59aa9260fda23842da4661511bb8bdc1..b671915abbde8fcc177e6a5bfb65f08d1511bea2 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -481,9 +481,9 @@ function user_block() {
$output .= "
\n";
$output .= "\n";
if (variable_get("user_register", 1)) {
- $output .= "» ". lm(t("Register"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account."))) ."\n";
+ $output .= "» ". lm(t("Register"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account."))) ."
\n";
}
- $output .= "
» ". lm(t("New password"), array("mod" => "user", "op" => "password"), "", array("title" => t("Request new password via e-mail"))) ."
";
+ $output .= "» ". lm(t("New password"), array("mod" => "user", "op" => "password"), "", array("title" => t("Request new password via e-mail")));
$block[1]["content"] = $output;
}
@@ -807,8 +807,11 @@ function user_login($edit = array(), $msg = "") {
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
$output .= form_submit(t("Log in"));
- $output .= "
» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
- $output .= "» " . lm(t("Create new account"), array("mod" => "user", "op" => "register")). "
» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
+ if (variable_get("user_register", 1)) {
+ $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ }
+ $output .= "
» ". lm(t("Log in"), array("mod" =>user, "op" => "login")) ."
";
- $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register")) ."
» ". lm(t("Log in"), array("mod" =>user, "op" => "login")) ."
";
+ if (variable_get("user_register", 1)) {
+ $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ }
+ $output .= "
Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via email, so please configure your email settings using the Administration pages.
Your password is $pass. You may change your password on the next page.
Please login below.
"; - $output .= form_hidden("name", $user->name); + $output .= form_hidden("name", $account->name); $output .= form_hidden("pass", $pass); $output .= form_submit(t("Log in")); return form($output); } else { - global $HTTP_HOST; - $subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables); - $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables); - user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); - return t("Your password and further instructions have been sent to your e-mail address."); + if ($account->status) { + /* + ** Create new user account, no administrator approval required: + */ + + $subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables); + $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables); + user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + return t("Your password and further instructions have been sent to your e-mail address."); + } + else { + /* + ** Create new user account, administrator approval required: + */ + $subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables); + $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. Your account will have to be approved by the site administrator. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables); + user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + user_mail(variable_get("site_mail", ini_get("sendmail_from")), $subject, t("%u has applied for an account.\n\n%uri", array("%u" => $account->name, "%uri" => path_uri() . drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin"))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + return t("Your password and further instructions have been sent to your e-mail address."); + } } } else { @@ -1003,10 +1019,8 @@ function user_register($edit = array()) { } } $output .= form_submit(t("Create new account")); - $output .= "» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
- $output .= "» " .lm(t("Log in"), array("mod" => "user", "op" => "login")). "
» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
+ $output .= "» " .lm(t("Log in"), array("mod" => "user", "op" => "login")). "
» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
- $output .= "» " . lm(t("Create new account"), array("mod" => "user", "op" => "register")). "
» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
+ if (variable_get("user_register", 1)) {
+ $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ }
+ $output .= "
» ". lm(t("Log in"), array("mod" =>user, "op" => "login")) ."
";
- $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register")) ."
» ". lm(t("Log in"), array("mod" =>user, "op" => "login")) ."
";
+ if (variable_get("user_register", 1)) {
+ $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register"));
+ }
+ $output .= "
Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via email, so please configure your email settings using the Administration pages.
Your password is $pass. You may change your password on the next page.
Please login below.
"; - $output .= form_hidden("name", $user->name); + $output .= form_hidden("name", $account->name); $output .= form_hidden("pass", $pass); $output .= form_submit(t("Log in")); return form($output); } else { - global $HTTP_HOST; - $subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables); - $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables); - user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); - return t("Your password and further instructions have been sent to your e-mail address."); + if ($account->status) { + /* + ** Create new user account, no administrator approval required: + */ + + $subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables); + $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables); + user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + return t("Your password and further instructions have been sent to your e-mail address."); + } + else { + /* + ** Create new user account, administrator approval required: + */ + $subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables); + $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. Your account will have to be approved by the site administrator. You may now login to %uri". drupal_url(array("mod" => "user", "op" => "login"), "module") ." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables); + user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + user_mail(variable_get("site_mail", ini_get("sendmail_from")), $subject, t("%u has applied for an account.\n\n%uri", array("%u" => $account->name, "%uri" => path_uri() . drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin"))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); + return t("Your password and further instructions have been sent to your e-mail address."); + } } } else { @@ -1003,10 +1019,8 @@ function user_register($edit = array()) { } } $output .= form_submit(t("Create new account")); - $output .= "» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
- $output .= "» " .lm(t("Log in"), array("mod" => "user", "op" => "login")). "
» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
";
+ $output .= "» " .lm(t("Log in"), array("mod" => "user", "op" => "login")). "