Commit 623397d6 authored by Kjartan's avatar Kjartan

- fixing the logic for populating $node when adding a new node. Title, teaser,

  body will now be set correctly, or be left unset if no values are included in
  the request.
parent 980f0700
......@@ -928,7 +928,13 @@ function node_add($type) {
if ($type && node_access("create", $type)) {
// Initialize settings
$output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type, "status" => 1, "promote" => !module_exist("queue"), "moderate" => module_exist("queue"), "comment" => module_exist("queue") ? 2 : 0, "title" => check_input($edit["title"]), "body" => check_input($edit["body"])));
$node = array("uid" => $user->uid, "name" => $user->name, "type" => $type, "status" => 1, "promote" => !module_exist("queue"), "moderate" => module_exist("queue"), "comment" => module_exist("queue") ? 2 : 0);
foreach (array("title", "teaser", "body") as $field) {
if ($edit[$field]) {
$node[$field] = check_input($edit[$field]);
}
}
$output = node_form($node);
}
else {
......
......@@ -928,7 +928,13 @@ function node_add($type) {
if ($type && node_access("create", $type)) {
// Initialize settings
$output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type, "status" => 1, "promote" => !module_exist("queue"), "moderate" => module_exist("queue"), "comment" => module_exist("queue") ? 2 : 0, "title" => check_input($edit["title"]), "body" => check_input($edit["body"])));
$node = array("uid" => $user->uid, "name" => $user->name, "type" => $type, "status" => 1, "promote" => !module_exist("queue"), "moderate" => module_exist("queue"), "comment" => module_exist("queue") ? 2 : 0);
foreach (array("title", "teaser", "body") as $field) {
if ($edit[$field]) {
$node[$field] = check_input($edit[$field]);
}
}
$output = node_form($node);
}
else {
......
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